Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hist_all_htapes namelist flag to output all history fields #2061

Open
wants to merge 10 commits into
base: b4b-dev
Choose a base branch
from
8 changes: 7 additions & 1 deletion bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -992,10 +992,16 @@ If TRUE, implies output data on a 2D latitude/longitude grid. False means
output in 1D vector format. One setting per history tape series.
</entry>

<entry id="hist_all_htapes" type="logical" category="history"
group="clm_inparm" valid_values="" >
If TRUE, indicates output ALL history fields on the primary tape.
</entry>

<entry id="hist_empty_htapes" type="logical" category="history"
group="clm_inparm" valid_values="" >
If TRUE, indicates do NOT output any default history fields (requires you to use
hist_fincl* to set the exact output fields to use)..
hist_fincl1 to set the exact output fields to use). Note only the
primary tape has default history fields.
</entry>

<entry id="hist_fexcl1" type="char*64(1000)" category="history"
Expand Down
9 changes: 9 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,15 @@
<option name="comment" >Among other extra outputs, ensure that writing the list of all history fields to a separate file does not cause failure</option>
</options>
</test>
<test name="ERP_P36x2_D_Ld3" grid="f10_f10_mg37" compset="I1850Clm50BgcCrop" testmods="clm/default--clm/all_outputs">
<machines>
<machine name="cheyenne" compiler="gnu" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Test writing all history fields</option>
</options>
</test>
<test name="ERS_D_Ld3" grid="f10_f10_mg37" compset="I1850Clm50BgcCrop" testmods="clm/default">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,4 @@ fates_spitfire_mode = 1
fates_history_dimlevel = 2,2
use_fates_tree_damage = .true.
hist_ndens = 1
hist_fincl1 = 'FATES_TLONGTERM',
'FATES_TGROWTH','FATES_SEEDS_IN_GRIDCELL_PF','FATES_SEEDS_OUT_GRIDCELL_PF','FATES_NCL_AP',
'FATES_NPATCH_AP','FATES_VEGC_AP','FATES_SECONDAREA_ANTHRODIST_AP','FATES_SECONDAREA_DIST_AP',
'FATES_FUEL_AMOUNT_APFC','FATES_STOREC_TF_USTORY_SZPF','FATES_STOREC_TF_CANOPY_SZPF',
'FATES_CROWNAREA_CLLL','FATES_ABOVEGROUND_MORT_SZPF',
'FATES_ABOVEGROUND_PROD_SZPF','FATES_NPLANT_SZAP','FATES_NPLANT_CANOPY_SZAP',
'FATES_NPLANT_USTORY_SZAP','FATES_DDBH_CANOPY_SZAP','FATES_DDBH_USTORY_SZAP',
'FATES_MORTALITY_CANOPY_SZAP','FATES_MORTALITY_USTORY_SZAP','FATES_NPLANT_SZAPPF',
'FATES_NPP_APPF','FATES_VEGC_APPF','FATES_SCORCH_HEIGHT_APPF','FATES_GPP_SZPF',
'FATES_GPP_CANOPY_SZPF','FATES_AUTORESP_CANOPY_SZPF','FATES_GPP_USTORY_SZPF',
'FATES_AUTORESP_USTORY_SZPF','FATES_NPP_SZPF','FATES_LEAF_ALLOC_SZPF',
'FATES_SEED_ALLOC_SZPF','FATES_FROOT_ALLOC_SZPF','FATES_BGSAPWOOD_ALLOC_SZPF',
'FATES_BGSTRUCT_ALLOC_SZPF','FATES_AGSAPWOOD_ALLOC_SZPF','FATES_AGSTRUCT_ALLOC_SZPF',
'FATES_STORE_ALLOC_SZPF','FATES_DDBH_SZPF','FATES_GROWTHFLUX_SZPF','FATES_GROWTHFLUX_FUSION_SZPF',
'FATES_DDBH_CANOPY_SZPF','FATES_DDBH_USTORY_SZPF','FATES_BASALAREA_SZPF','FATES_VEGC_ABOVEGROUND_SZPF',
'FATES_NPLANT_SZPF','FATES_NPLANT_ACPF','FATES_MORTALITY_BACKGROUND_SZPF','FATES_MORTALITY_HYDRAULIC_SZPF',
'FATES_MORTALITY_CSTARV_SZPF','FATES_MORTALITY_IMPACT_SZPF','FATES_MORTALITY_FIRE_SZPF',
'FATES_MORTALITY_CROWNSCORCH_SZPF','FATES_MORTALITY_CAMBIALBURN_SZPF','FATES_MORTALITY_TERMINATION_SZPF',
'FATES_MORTALITY_LOGGING_SZPF','FATES_MORTALITY_FREEZING_SZPF','FATES_MORTALITY_SENESCENCE_SZPF',
'FATES_MORTALITY_AGESCEN_SZPF','FATES_MORTALITY_AGESCEN_ACPF','FATES_MORTALITY_CANOPY_SZPF',
'FATES_M3_MORTALITY_CANOPY_SZPF','FATES_M3_MORTALITY_USTORY_SZPF',
'FATES_STOREC_CANOPY_SZPF','FATES_LEAFC_CANOPY_SZPF','FATES_LAI_CANOPY_SZPF','FATES_CROWNAREA_CANOPY_SZPF',
'FATES_CROWNAREA_USTORY_SZPF','FATES_NPLANT_CANOPY_SZPF','FATES_MORTALITY_USTORY_SZPF','FATES_STOREC_USTORY_SZPF',
'FATES_LEAFC_USTORY_SZPF','FATES_LAI_USTORY_SZPF','FATES_NPLANT_USTORY_SZPF','FATES_CWD_ABOVEGROUND_DC',
'FATES_CWD_BELOWGROUND_DC','FATES_CWD_ABOVEGROUND_IN_DC','FATES_CWD_BELOWGROUND_IN_DC',
'FATES_CWD_ABOVEGROUND_OUT_DC','FATES_CWD_BELOWGROUND_OUT_DC','FATES_YESTCANLEV_CANOPY_SZ',
'FATES_YESTCANLEV_USTORY_SZ','FATES_VEGC_SZ','FATES_DEMOTION_RATE_SZ','FATES_PROMOTION_RATE_SZ',
'FATES_SAI_CANOPY_SZ','FATES_M3_MORTALITY_CANOPY_SZ','FATES_M3_MORTALITY_USTORY_SZ','FATES_SAI_USTORY_SZ',
'FATES_NPP_CANOPY_SZ','FATES_NPP_USTORY_SZ','FATES_TRIMMING_CANOPY_SZ','FATES_TRIMMING_USTORY_SZ',
'FATES_CROWNAREA_CANOPY_SZ','FATES_CROWNAREA_USTORY_SZ','FATES_LEAFCTURN_CANOPY_SZ','FATES_FROOTCTURN_CANOPY_SZ',
'FATES_STORECTURN_CANOPY_SZ','FATES_STRUCTCTURN_CANOPY_SZ','FATES_SAPWOODCTURN_CANOPY_SZ','FATES_SEED_PROD_CANOPY_SZ',
'FATES_LEAF_ALLOC_CANOPY_SZ','FATES_FROOT_ALLOC_CANOPY_SZ','FATES_SAPWOOD_ALLOC_CANOPY_SZ','FATES_STRUCT_ALLOC_CANOPY_SZ',
'FATES_SEED_ALLOC_CANOPY_SZ','FATES_STORE_ALLOC_CANOPY_SZ','FATES_LEAFCTURN_USTORY_SZ','FATES_FROOTCTURN_USTORY_SZ',
'FATES_STORECTURN_USTORY_SZ','FATES_STRUCTCTURN_USTORY_SZ','FATES_SAPWOODCTURN_USTORY_SZ',
'FATES_SEED_PROD_USTORY_SZ','FATES_LEAF_ALLOC_USTORY_SZ','FATES_FROOT_ALLOC_USTORY_SZ','FATES_SAPWOOD_ALLOC_USTORY_SZ',
'FATES_STRUCT_ALLOC_USTORY_SZ','FATES_SEED_ALLOC_USTORY_SZ','FATES_STORE_ALLOC_USTORY_SZ','FATES_CROWNAREA_CANOPY_CD',
'FATES_CROWNAREA_USTORY_CD','FATES_NPLANT_CDPF','FATES_NPLANT_CANOPY_CDPF','FATES_NPLANT_USTORY_CDPF',
'FATES_M3_CDPF','FATES_M11_SZPF','FATES_M11_CDPF','FATES_MORTALITY_CDPF','FATES_M3_MORTALITY_CANOPY_CDPF',
'FATES_M3_MORTALITY_USTORY_CDPF','FATES_M11_MORTALITY_CANOPY_CDPF','FATES_M11_MORTALITY_USTORY_CDPF',
'FATES_MORTALITY_CANOPY_CDPF','FATES_MORTALITY_USTORY_CDPF','FATES_DDBH_CDPF','FATES_DDBH_CANOPY_CDPF',
'FATES_DDBH_USTORY_CDPF','FATES_VEGC_SZPF','FATES_LEAFC_SZPF','FATES_FROOTC_SZPF','FATES_SAPWOODC_SZPF',
'FATES_STOREC_SZPF','FATES_REPROC_SZPF','FATES_NPP_AP','FATES_GPP_AP','FATES_RDARK_USTORY_SZ',
'FATES_LSTEMMAINTAR_USTORY_SZ','FATES_CROOTMAINTAR_USTORY_SZ','FATES_FROOTMAINTAR_USTORY_SZ','FATES_GROWAR_USTORY_SZ',
'FATES_MAINTAR_USTORY_SZ','FATES_RDARK_CANOPY_SZ','FATES_CROOTMAINTAR_CANOPY_SZ','FATES_FROOTMAINTAR_CANOPY_SZ',
'FATES_GROWAR_CANOPY_SZ','FATES_MAINTAR_CANOPY_SZ','FATES_LSTEMMAINTAR_CANOPY_SZ','FATES_AUTORESP_SZPF',
'FATES_GROWAR_SZPF','FATES_MAINTAR_SZPF','FATES_RDARK_SZPF','FATES_AGSAPMAINTAR_SZPF','FATES_BGSAPMAINTAR_SZPF',
'FATES_FROOTMAINTAR_SZPF','FATES_PARSUN_CLLL','FATES_PARSHA_CLLL','FATES_PARSUN_CLLLPF','FATES_PARSHA_CLLLPF',
'FATES_PARSUN_CL','FATES_PARSHA_CL','FATES_LAISUN_CLLL','FATES_LAISHA_CLLL','FATES_LAISUN_CLLLPF',
'FATES_LAISHA_CLLLPF','FATES_PARPROF_DIR_CLLLPF','FATES_PARPROF_DIF_CLLLPF','FATES_LAISUN_CL','FATES_LAISHA_CL',
'FATES_PARPROF_DIR_CLLL','FATES_PARPROF_DIF_CLLL','FATES_NET_C_UPTAKE_CLLL','FATES_CROWNFRAC_CLLLPF',
'FATES_LBLAYER_COND_AP','FATES_STOMATAL_COND_AP'
hist_all_htapes = .true.
1 change: 1 addition & 0 deletions cime_config/testdefs/testmods_dirs/clm/all_outputs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This test mod turns on outputting of all history fields.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
calc_human_stress_indices = 'ALL'
hist_all_htapes = .true.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ Example 1-2. Default CLM Namelist
Adding/removing fields on your primary history file
---------------------------------------------------

The primary history files are output monthly, and contain an extensive list of fieldnames, but the list of fieldnames can be added to using ``hist_fincl1`` or removed from by adding fieldnames to ``hist_fexcl1``. A sample user namelist ``user_nl_clm`` adding few new fields (cosine of solar zenith angle, and solar declination) and excluding a few standard fields is (ground temperature, vegetation temperature, soil temperature and soil water).:
The primary history files are output monthly and contain an extensive list of fieldnames, but the list of fieldnames can be added to using ``hist_fincl1`` or removed from by adding fieldnames to ``hist_fexcl1``. For maximum output, ``hist_all_htapes`` will enable all fieldnames on the primary history file.

A sample user namelist ``user_nl_clm`` adding few new fields (cosine of solar zenith angle, and solar declination) and excluding a few standard fields is (ground temperature, vegetation temperature, soil temperature and soil water).:

Example 1-3. Example user_nl_clm namelist adding and removing fields on primary history file
--------------------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/biogeophys/FrictionVelocityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ subroutine InitHistory(this, bounds)
avgflag='A', long_name='friction velocity', &
ptr_patch=this%fv_patch, default='inactive')

this%rah1_patch(begp:endp) = spval
call hist_addfld1d (fname='RAH1', units='s/m', &
avgflag='A', long_name='aerodynamical resistance ', &
ptr_patch=this%rah1_patch, default='inactive')
Expand Down
6 changes: 4 additions & 2 deletions src/main/controlMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module controlMod
use clm_varpar , only: maxpatch_glc, numrad, nlevsno
use fileutils , only: getavu, relavu, get_filename
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_empty_htapes, hist_all_htapes, hist_dov2xy, hist_avgflag_pertape, hist_type1d_pertape
use histFileMod , only: hist_nhtfrq, hist_ndens, hist_mfilt, hist_fincl1, hist_fincl2, hist_fincl3
use histFileMod , only: hist_fincl4, hist_fincl5, hist_fincl6, hist_fincl7, hist_fincl8
use histFileMod , only: hist_fincl9, hist_fincl10
Expand Down Expand Up @@ -153,7 +153,8 @@ subroutine control_init(dtime)
! History, restart options

namelist /clm_inparm/ &
hist_empty_htapes, hist_dov2xy, &
hist_empty_htapes, hist_all_htapes, &
hist_dov2xy, &
hist_avgflag_pertape, hist_type1d_pertape, &
hist_nhtfrq, hist_ndens, hist_mfilt, &
hist_fincl1, hist_fincl2, hist_fincl3, &
Expand Down Expand Up @@ -930,6 +931,7 @@ subroutine control_spmd()

! history file variables
call mpi_bcast (hist_empty_htapes, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (hist_all_htapes, 1, MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (hist_dov2xy, size(hist_dov2xy), MPI_LOGICAL, 0, mpicom, ier)
call mpi_bcast (hist_nhtfrq, size(hist_nhtfrq), MPI_INTEGER, 0, mpicom, ier)
call mpi_bcast (hist_mfilt, size(hist_mfilt), MPI_INTEGER, 0, mpicom, ier)
Expand Down
20 changes: 9 additions & 11 deletions src/main/histFileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ module histFileMod
! only exist on history tape 1). Use hist_fincl1 to enable
! select fields on top of this.

logical, public :: &
hist_all_htapes = .false. ! namelist: enable all possible history fields on history
! tape 1. Use hist_fexcl1 to remove select fields on top
! of this.

character(len=max_namlen+2), public :: &
hist_fincl1(max_flds) = ' ' ! namelist: list of fields to include in history tape 1
! aka 'h0' history file.
Expand Down Expand Up @@ -919,28 +924,21 @@ subroutine htapes_fieldlist()
allhistfldname = allhistfldlist(f)%field%name
call list_index (fincl(1,t), allhistfldname, ff)

! if field is in include list, ff > 0
if (ff > 0) then

! if field is in include list, ff > 0 and htape_addfld
! will be called for field

avgflag = getflag (fincl(ff,t))
call htape_addfld (t, f, avgflag)

else if (.not. hist_empty_htapes) then

! find index of field in exclude list
! field not explicitly included. check exclude list

call list_index (fexcl(1,t), allhistfldname, ff)

! if field is in exclude list, ff > 0 and htape_addfld
! will not be called for field
! if field is not in exclude list, ff =0 and htape_addfld
! will be called for field (note that htape_addfld will be
! called below only if field is not in exclude list OR in
! include list
! if field is in exclude list, ff > 0.

if (ff == 0 .and. allhistfldlist(f)%actflag(t)) then
if (ff == 0 .and. (allhistfldlist(f)%actflag(t) .or. (hist_all_htapes .and. t == 1))) then
call htape_addfld (t, f, ' ')
end if

Expand Down
Loading