diff --git a/.CLMTrunkChecklist b/.CTSMTrunkChecklist
similarity index 95%
rename from .CLMTrunkChecklist
rename to .CTSMTrunkChecklist
index de48172bb3..116233a969 100644
--- a/.CLMTrunkChecklist
+++ b/.CTSMTrunkChecklist
@@ -1,6 +1,6 @@
-Checklist of steps to do to make a CLM Trunk Tag Mar/7th/2017
+Checklist of steps to do to make a CTSM Trunk Tag Mar/7th/2017
-CLM Code Management team.
+CTSM Software Management team.
See the wiki page for this on:
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index a6f3fa765b..0000000000
--- a/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-### General Type of Issue:
-Some example types are:
-- bug
-- enhancement
-- question
-
-### Details of Issue:
-(Be sure to give enough details that the issue can be understood sufficiently
-to replicate or to make the required changes)
-
-### For bugs fill out the following: (Otherwise remove, and remove any prompts that aren't useful)
------------------------------------------------------------------
-#### Important Details of your setup/configuration (compset, settings, etc.):
-
-#### Important output or errors that show the problem:
-
-#### What is the CTSM version you are using (output of git describe)?:
-
-#### What is the machine you are running on:?
-
------------------------------------------------------------------
diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md
new file mode 100644
index 0000000000..b03c77171d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/01_bug_report.md
@@ -0,0 +1,25 @@
+---
+name: Bug report
+about: Report a problem with the code
+
+---
+
+### 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
new file mode 100644
index 0000000000..d3c69aaf6a
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/02_support_needed.md
@@ -0,0 +1,36 @@
+---
+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
new file mode 100644
index 0000000000..25f47ff601
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/03_science_discussion.md
@@ -0,0 +1,7 @@
+---
+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
new file mode 100644
index 0000000000..61898d3a75
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/04_other.md
@@ -0,0 +1,7 @@
+---
+name: Other
+about: Other issues (enhancement, cleanup, documentation, etc.)
+
+---
+
+
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 422365325c..36a87f49f1 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -2,15 +2,19 @@
### Specific notes
+Contributors other than yourself, if any:
+
CTSM Issues Fixed (include github issue #):
Are answers expected to change (and if so in what way)?
Any User Interface Changes (namelist or namelist defaults changes)?
-Testing performed:
+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 77da6f1745..abebdd6657 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,18 +58,27 @@ 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
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ddcfdf1702..70bf041ba7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,11 +1,15 @@
## How to contribute:
-It's recommended that you first contact ctsm-software@ucar.edu to discuss the changes or additions that you propose.
-Work with them to think about the design and implemention of the changes as well as the planning
-and scheduling for the change to come into CTSM.
-
-It's also recommened 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 develepments and tags.
+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
@@ -41,4 +45,4 @@ 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.
+See the `CODE_OF_CONDUCT.md` file for expectations of how to work in the community.
diff --git a/Externals.cfg b/Externals.cfg
index 454a2bc845..db147599f9 100644
--- a/Externals.cfg
+++ b/Externals.cfg
@@ -8,7 +8,7 @@ required = True
local_path = components/cism
protocol = git
repo_url = https://github.com/ESCOMP/cism-wrapper
-tag = release-v2.1.01
+tag = release-cesm2.0.04
externals = Externals_CISM.cfg
required = True
@@ -30,7 +30,7 @@ required = True
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
-tag = cime_cesm2_0_rel_03
+tag = cime5.6.10
required = True
[externals_description]
diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml
index e4fe10aca1..ba51cee3c9 100644
--- a/bld/namelist_files/namelist_defaults_clm4_5.xml
+++ b/bld/namelist_files/namelist_defaults_clm4_5.xml
@@ -502,7 +502,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
hgrid=1.9x2.5 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. 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.IGM2000GSWP3CLM50BGCCROPIRR.2011-01-01.1.9x2.5_gx1v6_gl5_simyr2000_c170419.nc
+ ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true."
+>lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc
diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml
index 0091aaa81e..1bce46e1e0 100644
--- a/bld/namelist_files/use_cases/1850_control.xml
+++ b/bld/namelist_files/use_cases/1850_control.xml
@@ -32,11 +32,11 @@
1850
1850
-lnd/clm2/ndepdata/fndep_clm_hist_simyr1850_0.9x1.25_CMIP6alpha02_c180426.nc
+lnd/clm2/ndepdata/fndep_clm_hist_simyr1850_0.9x1.25_CMIP6_c180617.nc
-cycle
+cycle
-NDEP_month
+NDEP_month
diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml
index a671a234cf..ae07999599 100644
--- a/cime_config/testdefs/ExpectedTestFails.xml
+++ b/cime_config/testdefs/ExpectedTestFails.xml
@@ -7,6 +7,8 @@
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 ERP_Ld9.f45_f45_mg37.I2000Clm45Fates.hobart_nag.clm-FatesAllVars COMPARE_base_rest
diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml
index 16ce488c5f..5adc7d615d 100644
--- a/cime_config/testdefs/testlist_clm.xml
+++ b/cime_config/testdefs/testlist_clm.xml
@@ -497,6 +497,7 @@
+
@@ -1023,7 +1024,7 @@
-
+
@@ -1129,6 +1130,7 @@
+
@@ -1155,6 +1157,7 @@
+
@@ -1163,6 +1166,7 @@
+
@@ -1537,12 +1541,13 @@
-
+
+
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
index 279790a585..62299f7ee4 100644
--- 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
@@ -10,4 +10,4 @@
hist_type1d_pertape = ' ',' ',' '
use_init_interp = .true.
- finidat = '/glade/p/image/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0001.r.2001-01-01-00000.nc'
+ 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
index f22be214e0..0df6e5a2a2 100644
--- 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
@@ -10,4 +10,4 @@
hist_type1d_pertape = ' ',' ',' '
use_init_interp = .true.
- finidat = '/glade/p/image/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0002.r.2001-01-01-00000.nc'
+ 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/usermods_dirs/cmip6_output/user_nl_clm b/cime_config/usermods_dirs/cmip6_output/user_nl_clm
index bd333a213b..5c9890a64f 100644
--- a/cime_config/usermods_dirs/cmip6_output/user_nl_clm
+++ b/cime_config/usermods_dirs/cmip6_output/user_nl_clm
@@ -18,26 +18,60 @@
! 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'
+'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'
+'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'
+'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','TOTSOMC:I', 'TOTSOMC_1m:I', 'TOTECOSYSC:I', 'TOTVEGC:I', 'WOODC:I', 'TOTLITC:I', 'LIVECROOTC:I', 'DEADCROOTC:I',
-'FROOTC:I'
+'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', 'FSNO_ICE', 'QICE_FORC', 'TSRF_FORC', 'TOPO_FORC'
+'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'
-hist_mfilt = 1,1,1,1
-hist_dov2xy = .true.,.false.,.false.,.true.
-hist_nhtfrq = 0,0,0,-8760
-hist_type1d_pertape = '','','LAND',''
+! 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/doc/.ChangeLog_template b/doc/.ChangeLog_template
index 3a47980dfa..b86cbbae0f 100644
--- a/doc/.ChangeLog_template
+++ b/doc/.ChangeLog_template
@@ -21,12 +21,26 @@ Known bugs introduced in this tag (include github issue ID): [If none, remove th
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 CLM's user interface (e.g., new/renamed XML or namelist variables):
+Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables):
Changes made to namelist defaults (e.g., changed parameter values):
@@ -36,7 +50,7 @@ Substantial timing or memory changes:
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
+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):
@@ -45,14 +59,14 @@ Changes to tests or testing:
Code reviewed by:
-CLM testing:
+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 CLM source is modified)
+ 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)
@@ -85,7 +99,7 @@ CLM testing:
hobart_pgi --------
hobart_intel ------
-CLM tag used for the baseline comparisons:
+CTSM tag used for the baseline comparisons:
Answer changes
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 368d1742a0..4a76ea33f0 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,4 +1,352 @@
===============================================================
+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
+
+===============================================================
+===============================================================
Tag name: clm5.0.dev013
Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326)
Date: Tue Jun 12 13:46:31 MDT 2018
diff --git a/doc/ChangeSum b/doc/ChangeSum
index 3bfde45f41..3fbeec19fb 100644
--- a/doc/ChangeSum
+++ b/doc/ChangeSum
@@ -1,5 +1,9 @@
Tag Who Date Summary
============================================================================================================================
+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
diff --git a/doc/design/oo_design.rst b/doc/design/oo_design.rst
new file mode 100644
index 0000000000..6d2a355867
--- /dev/null
+++ b/doc/design/oo_design.rst
@@ -0,0 +1,17 @@
+.. 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
index 5ee9d6256c..fdeadb141a 100644
--- a/doc/release-clm5.0.ChangeLog
+++ b/doc/release-clm5.0.ChangeLog
@@ -1,4 +1,106 @@
===============================================================
+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
diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90
index 57cee383d5..2ec35353f0 100644
--- a/src/biogeochem/CNVegCarbonFluxType.F90
+++ b/src/biogeochem/CNVegCarbonFluxType.F90
@@ -1662,13 +1662,11 @@ subroutine InitHistory(this, bounds, carbon_type)
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
+ 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', &
@@ -3322,7 +3320,7 @@ subroutine InitCold(this, bounds)
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
@@ -3574,6 +3572,8 @@ subroutine RestartBulkOnly ( this, bounds, ncid, flag )
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
diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90
index 1bb630c687..6836fd74a1 100644
--- a/src/biogeochem/CNVegNitrogenFluxType.F90
+++ b/src/biogeochem/CNVegNitrogenFluxType.F90
@@ -178,7 +178,6 @@ module CNVegNitrogenFluxType
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)
@@ -1267,42 +1266,42 @@ subroutine InitCold(this, bounds)
if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then
this%fert_counter_patch(p) = 0._r8
end if
- if ( use_fun ) then
+ if ( use_fun ) then !previously set to spval for special land units
if (lun%ifspecial(l)) then
- this%plant_ndemand_patch(p) = spval
- this%avail_retransn_patch(p) = spval
- this%plant_nalloc_patch(p) = spval
- this%Npassive_patch(p) = spval
- this%Nactive_patch(p) = spval
- this%Nnonmyc_patch(p) = spval
- this%Nam_patch(p) = spval
- this%Necm_patch(p) = spval
+ 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) = spval
- this%Nactive_nh4_patch(p) = spval
- this%Nnonmyc_no3_patch(p) = spval
- this%Nnonmyc_nh4_patch(p) = spval
- this%Nam_no3_patch(p) = spval
- this%Nam_nh4_patch(p) = spval
- this%Necm_no3_patch(p) = spval
- this%Necm_nh4_patch(p) = spval
+ 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) = spval
- this%Nretrans_patch(p) = spval
- this%Nretrans_org_patch(p) = spval
- this%Nretrans_season_patch(p) = spval
- this%Nretrans_stress_patch(p) = spval
- this%Nuptake_patch(p) = spval
- this%sminn_to_plant_fun_patch(p) = spval
- this%cost_nfix_patch = spval
- this%cost_nactive_patch = spval
- this%cost_nretrans_patch = spval
- this%nuptake_npp_fraction_patch = spval
+ 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) = spval
- this%sminn_to_plant_fun_no3_vr_patch(p,j) = spval
- this%sminn_to_plant_fun_nh4_vr_patch(p,j) = spval
+ 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
@@ -1409,108 +1408,132 @@ subroutine Restart (this, bounds, ncid, flag )
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
diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90
index 7c9feb8a25..9b662bb372 100644
--- a/src/biogeophys/CanopyFluxesMod.F90
+++ b/src/biogeophys/CanopyFluxesMod.F90
@@ -452,6 +452,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,
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)
@@ -1235,6 +1236,12 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,
+ 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)
diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90
index b0953c1e99..05dcb8a145 100644
--- a/src/biogeophys/HydrologyNoDrainageMod.F90
+++ b/src/biogeophys/HydrologyNoDrainageMod.F90
@@ -132,6 +132,7 @@ subroutine HydrologyNoDrainage(bounds, &
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)
@@ -344,6 +345,7 @@ subroutine HydrologyNoDrainage(bounds, &
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
@@ -362,6 +364,9 @@ subroutine HydrologyNoDrainage(bounds, &
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
diff --git a/src/biogeophys/LakeFluxesMod.F90 b/src/biogeophys/LakeFluxesMod.F90
index a2165ddd0c..3d447ec111 100644
--- a/src/biogeophys/LakeFluxesMod.F90
+++ b/src/biogeophys/LakeFluxesMod.F90
@@ -182,6 +182,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep,
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)
@@ -657,7 +658,7 @@ subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep,
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
diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90
index 8b6e708606..e735d74ce0 100644
--- a/src/biogeophys/PhotosynthesisMod.F90
+++ b/src/biogeophys/PhotosynthesisMod.F90
@@ -107,7 +107,8 @@ module PhotosynthesisMod
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)
@@ -250,6 +251,8 @@ subroutine InitAllocate(this, bounds)
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
@@ -485,7 +488,28 @@ subroutine InitHistory(this, bounds)
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', &
@@ -770,6 +794,18 @@ subroutine Restart(this, bounds, ncid, flag)
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', &
@@ -919,7 +955,9 @@ subroutine Photosynthesis ( bounds, fn, filterp, &
! a multi-layer canopy
!
! !USES:
- use clm_varcon , only : rgas, tfrz
+ 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
@@ -1062,6 +1100,12 @@ subroutine Photosynthesis ( bounds, fn, filterp, &
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
@@ -1112,6 +1156,8 @@ subroutine Photosynthesis ( bounds, fn, filterp, &
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)
@@ -1171,6 +1217,11 @@ subroutine Photosynthesis ( bounds, fn, filterp, &
! 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
@@ -1528,6 +1579,7 @@ subroutine Photosynthesis ( bounds, fn, filterp, &
do f = 1, fn
p = filterp(f)
c = patch%column(p)
+ g = patch%gridcell(p)
! Leaf boundary layer conductance, umol/m**2/s
@@ -1602,6 +1654,25 @@ subroutine Photosynthesis ( bounds, fn, filterp, &
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)
@@ -2368,7 +2439,9 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
! method
!
! !USES:
- use clm_varcon , only : rgas, tfrz, rpi
+ 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
@@ -2558,8 +2631,10 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
real(r8) :: sum_nscaler
real(r8) :: total_lai
integer :: nptreemax
-!scs
- integer :: j ! index
+ 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]
@@ -2578,6 +2653,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
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
!------------------------------------------------------------------------------
@@ -2670,7 +2746,9 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
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_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)
@@ -2710,6 +2788,11 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
! 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
@@ -3146,6 +3229,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
do f = 1, fn
p = filterp(f)
c = patch%column(p)
+ g = patch%gridcell(p)
! Leaf boundary layer conductance, umol/m**2/s
@@ -3180,14 +3264,11 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
aj(p,sun,iv) = 0._r8
ap(p,sun,iv) = 0._r8
ag(p,sun,iv) = 0._r8
-!KO an_sun(p,iv) = ag(p,sun,iv) - bsun(p) * lmr_z_sun(p,iv)
-!KO
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
-!KO
psn_z_sun(p,iv) = 0._r8
psn_wc_z_sun(p,iv) = 0._r8
psn_wj_z_sun(p,iv) = 0._r8
@@ -3200,14 +3281,11 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
aj(p,sha,iv) = 0._r8
ap(p,sha,iv) = 0._r8
ag(p,sha,iv) = 0._r8
-!KO an_sha(p,iv) = ag(p,sha,iv) - bsha(p) * lmr_z_sha(p,iv)
-!KO
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
-!KO
psn_z_sha(p,iv) = 0._r8
psn_wc_z_sha(p,iv) = 0._r8
psn_wj_z_sha(p,iv) = 0._r8
@@ -3278,6 +3356,17 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
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)
@@ -3397,17 +3486,11 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
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)
-!KO lmrcan_sun = lmrcan_sun + lmr_z_sun(p,iv) * lai_z_sun(p,iv)
-!KO
-! lmrcan_sun = lmrcan_sun + lmr_z_sun(p,iv) * lai_z_sun(p,iv) * bsun(p)
-!KO
-!KO
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
-!KO
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
@@ -3438,17 +3521,11 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
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)
-!KO lmrcan_sha = lmrcan_sha + lmr_z_sha(p,iv) * lai_z_sha(p,iv)
-!KO
-! lmrcan_sha = lmrcan_sha + lmr_z_sha(p,iv) * lai_z_sha(p,iv) * bsha(p)
-!KO
-!KO
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
-!KO
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
@@ -3578,6 +3655,8 @@ subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha,
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
@@ -3769,6 +3848,8 @@ subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha
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
@@ -3860,7 +3941,9 @@ subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha
endif
enddo
- call ci_func_PHS(x,b(sun), b(sha), fb(sun), fb(sha), ip, iv, ic, bsun, bsha, bflag, gb_mol, gs_mol_sun, gs_mol_sha,&
+ 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)
diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90
index 1dabba664d..fefb8e617f 100644
--- a/src/biogeophys/SoilFluxesMod.F90
+++ b/src/biogeophys/SoilFluxesMod.F90
@@ -35,6 +35,7 @@ module SoilFluxesMod
!-----------------------------------------------------------------------
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)
@@ -55,6 +56,8 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, &
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
@@ -99,6 +102,9 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, &
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
@@ -405,6 +411,17 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, &
+ (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)
@@ -425,6 +442,15 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, &
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
diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90
index e2516505e7..5dfc3bc704 100644
--- a/src/biogeophys/TemperatureType.F90
+++ b/src/biogeophys/TemperatureType.F90
@@ -23,6 +23,7 @@ module TemperatureType
! 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
@@ -33,6 +34,7 @@ module TemperatureType
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)
@@ -187,6 +189,7 @@ subroutine InitAllocate(this, bounds)
! 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
@@ -212,7 +215,9 @@ subroutine InitAllocate(this, bounds)
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
@@ -383,6 +388,11 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp )
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', &
@@ -412,6 +422,10 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp )
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; '// &
diff --git a/src/cpl/lnd_import_export.F90 b/src/cpl/lnd_import_export.F90
index c255ec479f..4923b721af 100644
--- a/src/cpl/lnd_import_export.F90
+++ b/src/cpl/lnd_import_export.F90
@@ -247,6 +247,9 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst)
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
diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90
index db2d567a45..a50a57abe3 100644
--- a/src/main/clm_driver.F90
+++ b/src/main/clm_driver.F90
@@ -663,6 +663,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
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, &
diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90
index 5e4378ae2c..ae9c2fcafe 100644
--- a/src/main/controlMod.F90
+++ b/src/main/controlMod.F90
@@ -23,8 +23,10 @@ module controlMod
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_fexcl1, hist_fexcl2, hist_fexcl3
- use histFileMod , only: hist_fexcl4, hist_fexcl5, hist_fexcl6
+ 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
@@ -158,8 +160,12 @@ subroutine control_init( )
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_fexcl4, hist_fexcl5, hist_fexcl6, &
+ hist_fexcl7, hist_fexcl8, &
+ hist_fexcl9, hist_fexcl10
namelist /clm_inparm/ hist_wrtch4diag
! BGC info
@@ -730,12 +736,20 @@ subroutine control_spmd()
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
diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90
index f1ff0e48ca..49371a8c9d 100644
--- a/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90
+++ b/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90
@@ -294,7 +294,7 @@ subroutine InitHistory(this, bounds)
integer :: begc, endc
character(24) :: fieldname
character(100) :: longname
- character(8) :: vr_suffix
+ character(8) :: vr_suffix,default
real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays
!------------------------------------------------------------------------
@@ -316,15 +316,20 @@ subroutine InitHistory(this, bounds)
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)
+ 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)
+ ptr_col=this%ffix_to_sminn_col, default=default)
do l = 1, ndecomp_cascade_transitions
! vertically integrated fluxes
diff --git a/test/tools/README b/test/tools/README
index 43a5f42a20..4929144b20 100644
--- a/test/tools/README
+++ b/test/tools/README
@@ -13,9 +13,7 @@ To use...
on cheyenne
-qcmd -- ./test_driver.sh -i >& run.out &
-execgy
-./test_driver.sh -i >& run.out &
+qcmd -l walltime=06:00:00 -- ./test_driver.sh -i >& run.out &
Intended for use on NCAR machines cheyenne, geyser (DAV) and hobart.
diff --git a/test/tools/TCBCFGtools.sh b/test/tools/TCBCFGtools.sh
index 3b7e6fc9d3..5c0b015123 100755
--- a/test/tools/TCBCFGtools.sh
+++ b/test/tools/TCBCFGtools.sh
@@ -32,7 +32,11 @@ if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then
fi
fi
-cfgdir=`ls -1d ${CLM_ROOT}/tools/${1}*`
+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}
diff --git a/test/tools/input_tests_master b/test/tools/input_tests_master
index c45bc2c2db..84b98883eb 100644
--- a/test/tools/input_tests_master
+++ b/test/tools/input_tests_master
@@ -3,10 +3,10 @@
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 ../../cime/tools/mapping/gen_domain CFGtools__ds T31.runoptions
-ble14 TBLCFGtools.sh ../../cime/tools/mapping/gen_domain CFGtools__ds T31.runoptions
-sme@4 TSMCFGtools.sh ../../cime/tools/mapping/gen_domain CFGtools__ds ne30.runoptions
-ble@4 TBLCFGtools.sh ../../cime/tools/mapping/gen_domain CFGtools__ds ne30.runoptions
+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
diff --git a/test/tools/test_driver.sh b/test/tools/test_driver.sh
index 8faace3e89..935b7d2dd2 100755
--- a/test/tools/test_driver.sh
+++ b/test/tools/test_driver.sh
@@ -199,8 +199,8 @@ export P4_GLOBMEMSIZE=500000000
export CESM_MACH="hobart"
-limit stacksize unlimited
-limit coredumpsize unlimited
+ulimit -s unlimited
+ulimit -c unlimited
export CESM_COMP="intel"
export TOOLS_MAKE_STRING="USER_FC=ifort USER_CC=icc "
@@ -210,7 +210,9 @@ export INITMODULES="/usr/share/Modules/init/sh"
. \$INITMODULES
module purge
-module load compiler/intel/15.0.2.164
+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
diff --git a/tools/mkprocdata_map/src/Makefile.common b/tools/mkprocdata_map/src/Makefile.common
index bf8c80eed6..ab79f94144 100644
--- a/tools/mkprocdata_map/src/Makefile.common
+++ b/tools/mkprocdata_map/src/Makefile.common
@@ -190,8 +190,8 @@ ifeq ($(FC),ifort)
FFLAGS += -O2
endif
ifeq ($(SMP),TRUE)
- FFLAGS += -openmp
- LDFLAGS += -openmp
+ FFLAGS += -qopenmp
+ LDFLAGS += -qopenmp
endif
endif
@@ -215,7 +215,7 @@ endif
ifeq ($(CC),icc)
CFLAGS += -m64 -g
ifeq ($(SMP),TRUE)
- CFLAGS += -openmp
+ CFLAGS += -qopenmp
endif
endif
ifeq ($(CC),pgcc)
@@ -307,9 +307,9 @@ ifeq ($(UNAMES),Linux)
FFLAGS += -O2
endif
ifeq ($(SMP),TRUE)
- FFLAGS += -openmp
- CFLAGS += -openmp
- LDFLAGS += -openmp
+ FFLAGS += -qopenmp
+ CFLAGS += -qopenmp
+ LDFLAGS += -qopenmp
endif
endif
FFLAGS += -c -I$(INC_NETCDF) $(CPPDEF) $(cpp_path)
diff --git a/tools/mksurfdata_map/Makefile.data b/tools/mksurfdata_map/Makefile.data
index 74636175eb..abac6af279 100644
--- a/tools/mksurfdata_map/Makefile.data
+++ b/tools/mksurfdata_map/Makefile.data
@@ -54,17 +54,22 @@ endif
MKSURFDATA = $(BATCHJOBS) $(PWD)/mksurfdata.pl
-STANDARD_RES = 360x720cru,48x96,0.9x1.25,1.9x2.5,10x15,ne30np4
+# f19 and f09 are standard resolutions, f10 is used for testing, f45 is used for FATES
+# ne30np4 is standard resolution for SE dycore in CAM, T31 is for paleo, 360x720cru is for same resolution as forcing data
+STANDARD_RES = 360x720cru,48x96,0.9x1.25,1.9x2.5,10x15,4x5,ne30np4
+# ne120np4 is for high resolution SE dycore, ne16 is for testing SE dycore
+# T42 is for SCAM
+# f05 is needed for running full chemistry model
STANDARD = \
global-present \
- global-present-f45 \
+ global-present-f05 \
global-present-ne16np4 \
global-present-ne120np4 \
global-present-T42 \
global-historical \
global-historical-ne120np4 \
- global-transient-f45 \
+ global-transient-f05 \
global-transient \
global-transient-ne120np4
@@ -78,7 +83,7 @@ TROPICS = \
CROP = \
crop-global-present \
- crop-global-present-f45 \
+ crop-global-present-f05 \
crop-global-present-ne16np4 \
crop-global-present-ne120np4 \
crop-numa-present \
@@ -86,9 +91,9 @@ CROP = \
crop-smallville \
crop-smallville-historical \
crop-global-historical \
- crop-global-historical-f45 \
+ crop-global-historical-f05 \
crop-global-historical-ne120np4 \
- crop-global-transient-f45 \
+ crop-global-transient-f05 \
crop-global-transient \
crop-global-transient-ne120np4
@@ -107,9 +112,10 @@ standard : $(STANDARD)
global-present : FORCE
$(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res $(STANDARD_RES) $(BACKGROUND)
-global-present-f45 : FORCE
- $(MKSURFDATA) -no-crop -glc_nec 10 -y 1850,2000 -res 4x5 $(BACKGROUND)
+global-present-f05 : FORCE
+ $(MKSURFDATA) -no-crop -glc_nec 10 -y 1850,2000 -res 0.47x0.63 $(BACKGROUND)
+# T42 is needed for SCAM
global-present-T42 : FORCE
$(MKSURFDATA) -no-crop -glc_nec 10 -y 2000 -res 64x128 $(BACKGROUND)
@@ -134,8 +140,8 @@ global-transient : FORCE
global-transient-ne120np4 : FORCE
$(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res ne120np4 $(BACKGROUND)
-global-transient-f45 : FORCE
- $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res 4x5 $(BACKGROUND)
+global-transient-f05 : FORCE
+ $(MKSURFDATA) -no-crop -no_surfdata -glc_nec 10 -y 1850-2000 -res 0.47x0.63 $(BACKGROUND)
#
# tropics
@@ -171,8 +177,8 @@ crop-global-present : FORCE
crop-global-present-0.125 : FORCE
$(MKSURFDATA) -hirespft -glc_nec 10 -y 2000 -r 0.125x0.125 $(BACKGROUND)
-crop-global-present-f45 : FORCE
- $(MKSURFDATA) -glc_nec 10 -y 1850,2000 -res 4x5 $(BACKGROUND)
+crop-global-present-f05 : FORCE
+ $(MKSURFDATA) -glc_nec 10 -y 1850,2000 -res 0.47x0.63 $(BACKGROUND)
crop-numa-present : FORCE
$(MKSURFDATA) -glc_nec 10 -y 2000 -r 1x1_numaIA $(BACKGROUND)
@@ -202,8 +208,8 @@ crop-smallville-historical : FORCE
crop-global-historical : FORCE
$(MKSURFDATA) -glc_nec 10 -y 1850 -res $(STANDARD_RES) $(BACKGROUND)
-crop-global-historical-f45 : FORCE
- $(MKSURFDATA) -glc_nec 10 -y 1850 -r 4x5 $(BACKGROUND)
+crop-global-historical-f05 : FORCE
+ $(MKSURFDATA) -glc_nec 10 -y 1850 -r 0.47x0.63 $(BACKGROUND)
crop-global-historical-ne120np4 : FORCE
$(MKSURFDATA) -glc_nec 10 -y 1850 -res ne120np4 $(BACKGROUND)
@@ -214,8 +220,8 @@ crop-global-transient: FORCE
crop-global-transient-ne120np4 : FORCE
$(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res ne120np4 $(BACKGROUND)
-crop-global-transient-f45 : FORCE
- $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res 4x5 $(BACKGROUND)
+crop-global-transient-f05 : FORCE
+ $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-2000 -res 0.47x0.63 $(BACKGROUND)
#
# urban
#
diff --git a/tools/mksurfdata_map/src/Makefile.common b/tools/mksurfdata_map/src/Makefile.common
index bf8c80eed6..ab79f94144 100644
--- a/tools/mksurfdata_map/src/Makefile.common
+++ b/tools/mksurfdata_map/src/Makefile.common
@@ -190,8 +190,8 @@ ifeq ($(FC),ifort)
FFLAGS += -O2
endif
ifeq ($(SMP),TRUE)
- FFLAGS += -openmp
- LDFLAGS += -openmp
+ FFLAGS += -qopenmp
+ LDFLAGS += -qopenmp
endif
endif
@@ -215,7 +215,7 @@ endif
ifeq ($(CC),icc)
CFLAGS += -m64 -g
ifeq ($(SMP),TRUE)
- CFLAGS += -openmp
+ CFLAGS += -qopenmp
endif
endif
ifeq ($(CC),pgcc)
@@ -307,9 +307,9 @@ ifeq ($(UNAMES),Linux)
FFLAGS += -O2
endif
ifeq ($(SMP),TRUE)
- FFLAGS += -openmp
- CFLAGS += -openmp
- LDFLAGS += -openmp
+ FFLAGS += -qopenmp
+ CFLAGS += -qopenmp
+ LDFLAGS += -qopenmp
endif
endif
FFLAGS += -c -I$(INC_NETCDF) $(CPPDEF) $(cpp_path)
diff --git a/tools/mksurfdata_map/src/mkpctPftTypeMod.F90 b/tools/mksurfdata_map/src/mkpctPftTypeMod.F90
index a47d67dd2a..8c2c9b7c53 100644
--- a/tools/mksurfdata_map/src/mkpctPftTypeMod.F90
+++ b/tools/mksurfdata_map/src/mkpctPftTypeMod.F90
@@ -46,6 +46,7 @@ module mkpctPftTypeMod
end type pct_pft_type
! !PUBLIC MEMBER FUNCTIONS
+ public :: update_max_array ! given an array of pct_pft_type variables update the max_p2l values from pct_p2l
public :: get_pct_p2l_array ! given an array of pct_pft_type variables, return a 2-d array of pct_p2l
public :: get_pct_l2g_array ! given an array of pct_pft_type variables, return an array of pct_l2g
@@ -409,8 +410,6 @@ subroutine remove_small_cover(this, too_small, nsmall)
deallocate(pct_p2g, is_small, is_zero)
end subroutine remove_small_cover
-
-
! ========================================================================
! Private member functions
! ========================================================================
@@ -511,6 +510,54 @@ end subroutine check_vals
! Module-level routines (not member functions)
! ========================================================================
+ !-----------------------------------------------------------------------
+ subroutine update_max_array(pct_pft_max_arr,pct_pft_arr)
+ !
+ ! !DESCRIPTION:
+ ! Given an array of pct_pft_type variables, update all the max_p2l variables.
+ !
+ ! Assumes that all elements of pct_pft_max_arr and pct_pft_arr have the same
+ ! size and lower bound for their pct_p2l array.
+ !
+ ! !ARGUMENTS:
+ ! workaround for gfortran bug (58043): declare this 'type' rather than 'class':
+ type(pct_pft_type), intent(inout) :: pct_pft_max_arr(:)
+ type(pct_pft_type), intent(in) :: pct_pft_arr(:)
+ !
+ ! !LOCAL VARIABLES:
+ integer :: pft_lbound
+ integer :: pft_ubound
+ integer :: arr_index
+ integer :: pft_index
+
+ character(len=*), parameter :: subname = 'update_max_array'
+ !-----------------------------------------------------------------------
+
+
+ pft_lbound = lbound(pct_pft_arr(1)%pct_p2l, 1)
+ pft_ubound = ubound(pct_pft_arr(1)%pct_p2l, 1)
+
+ do arr_index = 1, size(pct_pft_arr)
+ if (lbound(pct_pft_arr(arr_index)%pct_p2l, 1) /= pft_lbound .or. &
+ ubound(pct_pft_arr(arr_index)%pct_p2l, 1) /= pft_ubound) then
+ write(6,*) subname//' ERROR: all elements of pct_pft_arr must have'
+ write(6,*) 'the same size and lower bound for their pct_p2l array'
+ call abort()
+ end if
+
+ if (pct_pft_arr(arr_index)%pct_l2g > pct_pft_max_arr(arr_index)%pct_l2g) then
+ pct_pft_max_arr(arr_index)%pct_l2g = pct_pft_arr(arr_index)%pct_l2g
+ end if
+
+ do pft_index = pft_lbound, pft_ubound
+ if (pct_pft_arr(arr_index)%pct_p2l(pft_index) > pct_pft_max_arr(arr_index)%pct_p2l(pft_index)) then
+ pct_pft_max_arr(arr_index)%pct_p2l(pft_index) = pct_pft_arr(arr_index)%pct_p2l(pft_index)
+ end if
+ end do
+ end do
+
+ end subroutine update_max_array
+
!-----------------------------------------------------------------------
function get_pct_p2l_array(pct_pft_arr) result(pct_p2l)
!
diff --git a/tools/mksurfdata_map/src/mkpftMod.F90 b/tools/mksurfdata_map/src/mkpftMod.F90
index 5a3686a0ae..c99d66c9ac 100644
--- a/tools/mksurfdata_map/src/mkpftMod.F90
+++ b/tools/mksurfdata_map/src/mkpftMod.F90
@@ -1008,6 +1008,8 @@ subroutine mkpftAtt( ncid, dynlanduse, xtype )
call ncd_def_spatial_var(ncid=ncid, varname='PCT_CROP', xtype=xtype, &
lev1name='time', &
long_name='total percent crop landunit', units='unitless')
+ call ncd_def_spatial_var(ncid=ncid, varname='PCT_CROP_MAX', xtype=xtype, &
+ long_name='maximum total percent crop landunit during time period', units='unitless')
end if
! PCT_NAT_PFT
@@ -1019,6 +1021,9 @@ subroutine mkpftAtt( ncid, dynlanduse, xtype )
call ncd_def_spatial_var(ncid=ncid, varname='PCT_NAT_PFT', xtype=xtype, &
lev1name='natpft', lev2name='time', &
long_name='percent plant functional type on the natural veg landunit (% of landunit)', units='unitless')
+ call ncd_def_spatial_var(ncid=ncid, varname='PCT_NAT_PFT_MAX', xtype=xtype, &
+ lev1name='natpft', &
+ long_name='maximum percent plant functional type during time period (% of landunit)', units='unitless')
end if
! PCT_CFT
@@ -1031,6 +1036,9 @@ subroutine mkpftAtt( ncid, dynlanduse, xtype )
call ncd_def_spatial_var(ncid=ncid, varname='PCT_CFT', xtype=xtype, &
lev1name='cft', lev2name='time', &
long_name='percent crop functional type on the crop landunit (% of landunit)', units='unitless')
+ call ncd_def_spatial_var(ncid=ncid, varname='PCT_CFT_MAX', xtype=xtype, &
+ lev1name='cft', &
+ long_name='maximum percent crop functional type during time period (% of landunit)', units='unitless')
end if
end if
diff --git a/tools/mksurfdata_map/src/mksurfdat.F90 b/tools/mksurfdata_map/src/mksurfdat.F90
index 28a46165f9..fbbf57171a 100644
--- a/tools/mksurfdata_map/src/mksurfdat.F90
+++ b/tools/mksurfdata_map/src/mksurfdat.F90
@@ -15,7 +15,7 @@ program mksurfdat
use shr_kind_mod , only : r8 => shr_kind_r8, r4 => shr_kind_r4
use fileutils , only : opnfil, getavu
use mklaiMod , only : mklai
- use mkpctPftTypeMod , only : pct_pft_type, get_pct_p2l_array, get_pct_l2g_array
+ use mkpctPftTypeMod , only : pct_pft_type, get_pct_p2l_array, get_pct_l2g_array, update_max_array
use mkpftConstantsMod , only : natpft_lb, natpft_ub, cft_lb, cft_ub, num_cft
use mkpftMod , only : pft_idx, pft_frc, mkpft, mkpftInit, mkpft_parse_oride
use mksoilMod , only : soil_sand, soil_clay, mksoiltex, mksoilInit, &
@@ -90,9 +90,11 @@ program mksurfdat
real(r8), allocatable :: pctlnd_pft(:) ! PFT data: % of gridcell for PFTs
real(r8), allocatable :: pctlnd_pft_dyn(:) ! PFT data: % of gridcell for dyn landuse PFTs
integer , allocatable :: pftdata_mask(:) ! mask indicating real or fake land type
- type(pct_pft_type), allocatable :: pctnatpft(:) ! % of grid cell that is nat veg, and breakdown into PFTs
- type(pct_pft_type), allocatable :: pctcft(:) ! % of grid cell that is crop, and breakdown into CFTs
- type(pct_pft_type), allocatable :: pctcft_saved(:) ! version of pctcft saved from the initial call to mkpft
+ type(pct_pft_type), allocatable :: pctnatpft(:) ! % of grid cell that is nat veg, and breakdown into PFTs
+ type(pct_pft_type), allocatable :: pctnatpft_max(:) ! % of grid cell maximum PFTs of the time series
+ type(pct_pft_type), allocatable :: pctcft(:) ! % of grid cell that is crop, and breakdown into CFTs
+ type(pct_pft_type), allocatable :: pctcft_max(:) ! % of grid cell maximum CFTs of the time series
+ type(pct_pft_type), allocatable :: pctcft_saved(:) ! version of pctcft saved from the initial call to mkpft
real(r8), pointer :: harvest1D(:) ! harvest 1D data: normalized harvesting
real(r8), pointer :: harvest2D(:,:) ! harvest 1D data: normalized harvesting
real(r8), allocatable :: pctgla(:) ! percent of grid cell that is glacier
@@ -416,7 +418,9 @@ program mksurfdat
pctlnd_pft(ns_o) , &
pftdata_mask(ns_o) , &
pctnatpft(ns_o) , &
+ pctnatpft_max(ns_o) , &
pctcft(ns_o) , &
+ pctcft_max(ns_o) , &
pctcft_saved(ns_o) , &
pctgla(ns_o) , &
pctlak(ns_o) , &
@@ -1097,6 +1101,9 @@ program mksurfdat
nfdyn = getavu(); call opnfil (mksrf_fdynuse, nfdyn, 'f')
+ pctnatpft_max = pctnatpft
+ pctcft_max = pctcft
+
ntim = 0
do
! Read input pft data
@@ -1158,6 +1165,9 @@ program mksurfdat
call change_landuse(ldomain, dynpft=.true.)
call normalizencheck_landuse(ldomain)
+
+ call update_max_array(pctnatpft_max,pctnatpft)
+ call update_max_array(pctcft_max,pctcft)
! Output time-varying data for current year
@@ -1200,6 +1210,17 @@ program mksurfdat
end do ! end of read loop
+ call check_ret(nf_inq_varid(ncid, 'PCT_NAT_PFT_MAX', varid), subname)
+ call check_ret(nf_put_var_double(ncid, varid, get_pct_p2l_array(pctnatpft_max)), subname)
+
+ call check_ret(nf_inq_varid(ncid, 'PCT_CROP_MAX', varid), subname)
+ call check_ret(nf_put_var_double(ncid, varid, get_pct_l2g_array(pctcft_max)), subname)
+
+ if (num_cft > 0) then
+ call check_ret(nf_inq_varid(ncid, 'PCT_CFT_MAX', varid), subname)
+ call check_ret(nf_put_var_double(ncid, varid, get_pct_p2l_array(pctcft_max)), subname)
+ end if
+
call check_ret(nf_close(ncid), subname)
end if ! end of if-create dynamic landust dataset