Skip to content

Commit

Permalink
Merge pull request #468 from billsacks/simple_bfb
Browse files Browse the repository at this point in the history
Minor bug fixes, cleanup, documentation and enhancements
  • Loading branch information
ekluzek authored Aug 6, 2018
2 parents c39f035 + 21330dc commit 73f47fe
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 97 deletions.
61 changes: 34 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# directories checked out by manage_externals, and other files created
# by manage_externals
manage_externals.log
src/fates/
tools/PTCLM/
cime/
components/
/src/fates/
/tools/PTCLM/
/cime/
/components/

# ignore svn directories
**/.svn/**
Expand All @@ -26,28 +26,35 @@ CMakeFiles/


# unit testing directories
src/unit_tests.*
/src/unit_tests.*

# files generated by the unit test build
/src/dyn_subgrid/dynVarMod.F90
/src/dyn_subgrid/dynVarTimeInterpMod.F90
/src/dyn_subgrid/dynVarTimeUninterpMod.F90
/src/utils/array_utils.F90
/src/unit_test_stubs/utils/restUtilMod_stub.F90
/src/unit_test_stubs/main/ncdio_pio_fake.F90
/src/unit_test_stubs/main/ncdio_var.F90
/src/unit_test_shr/unittestArrayMod.F90

# cime_config
buildnmlc
buildcppc

# don't ignore cism build utilities directory
!components/cism/**/build

# configure / build files
bld/**/CESM_cppdefs
bld/**/Filepath
bld/**/config_cache.xml
bld/**/lnd_in
bld/**/drv_flds_in
/bld/**/CESM_cppdefs
/bld/**/Filepath
/bld/**/config_cache.xml
/bld/**/lnd_in
/bld/**/drv_flds_in

# build-naemlist testing
bld/unit_testers/lnd_in*
bld/unit_testers/drv_flds_in*
bld/unit_testers/temp_file.txt*
bld/unit_testers/user_nl_clm_real_parameters*
bld/unit_testers/env_run.xml
/bld/unit_testers/lnd_in*
/bld/unit_testers/drv_flds_in*
/bld/unit_testers/temp_file.txt*
/bld/unit_testers/user_nl_clm_real_parameters*
/bld/unit_testers/env_run.xml

# tools testing output
td.*.status
Expand All @@ -66,19 +73,19 @@ clm.input_data_list.previous
*.stdout.txt.o*

# Tools executables
tools/mksurfdata_map/mksurfdata_map
tools/mkprocdata_map/mkprocdata_map
/tools/mksurfdata_map/mksurfdata_map
/tools/mkprocdata_map/mkprocdata_map

# mksurfdata output files
tools/mksurfdata_map/surfdata_*.nc
tools/mksurfdata_map/landuse.timeseries_*.nc
/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
/tools/mkmapdata/PET*.RegridWeightGen.Log
/tools/mkmapdata/regrid.*.out
/tools/mkmapdata/regrid.*.err
/tools/mkmapdata/regrid.o*
/tools/mkmapdata/map*.nc

# build output
*.o
Expand Down
32 changes: 18 additions & 14 deletions bld/namelist_files/namelist_definition_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2432,20 +2432,24 @@ to the atmosphere) (but using the 'general' method will typically have
only a very minor impact on results in this case). For this method to
work, the input finidat file needs to be at the same resolution as the
current configuration. So this is a less general form of
init_interp. However, it can be used when transitioning from a spinup
run to a transient run, or in other cases where the only difference is
in internal memory allocation. In order to catch possible problems, this
uses a different algorithm for finding the input point for each output
point, which ensures that each active output point is associated with
exactly one input point with the same latitude, longitude and type. This
method requires (a) the same grid for input and output, within roundoff;
(b) any non-zero-weight point in the input must have memory allocated
for it in this grid cell in the output (this will be satisfied if the
point is non-zero-weight on the surface dataset or if it's a point for
which we allocate memory even for zero-weight points); (c) any active
point in the output (based on the surface dataset and rules for
determining active points) must have a matching point in this grid cell
in the input.
init_interp. However, it can be used in cases where the only difference
is in internal memory allocation. In order to catch possible problems,
this uses a different algorithm for finding the input point for each
output point, which ensures that each active output point is associated
with exactly one input point with the same latitude, longitude and
type. This method requires (a) the same grid for input and output,
within roundoff; (b) any non-zero-weight point in the input must have
memory allocated for it in this grid cell in the output (this will be
satisfied if the point is non-zero-weight on the surface dataset or if
it's a point for which we allocate memory even for zero-weight points);
(c) any active point in the output (based on the surface dataset and
rules for determining active points) must have a matching point in this
grid cell in the input. (Note that this generally can NOT be used when
transitioning from a spinup run to a transient run, because spinup runs
typically have irrigation off and transient runs have irrigation on, and
the presence/absence of irrigation affects the subgrid structure; if it
weren't for that difference, then this option would be useful for this
use case.)

</entry>

Expand Down
13 changes: 3 additions & 10 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -657,14 +657,6 @@
<option name="tput_tolerance">0.5</option>
</options>
</test>
<test name="ERP_P36x2_Lm36" grid="f10_f10_musgs" compset="I2000Clm50BgcCrop" testmods="clm/irrigOn_reduceOutput">
<machines>
<machine name="cheyenne" compiler="intel" category="prebeta"/>
</machines>
<options>
<option name="wallclock">00:60:00</option>
</options>
</test>
<test name="ERP_P180x2_D" grid="f19_g17" compset="I2000Clm50SpRtmFl" testmods="clm/default">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_clm"/>
Expand Down Expand Up @@ -753,6 +745,7 @@
<test name="ERP_P72x2_Lm36" grid="f10_f10_musgs" compset="I2000Clm50BgcCrop" testmods="clm/clm50cropIrrigMonth_interp">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_clm"/>
<machine name="cheyenne" compiler="intel" category="prebeta"/>
</machines>
<options>
<option name="wallclock">01:40:00</option>
Expand Down Expand Up @@ -1350,10 +1343,10 @@
</test>
<test name="SMS_D_Ly6_Mmpi-serial" grid="1x1_smallvilleIA" compset="IHistClm45BgcCropQianGs" testmods="clm/cropMonthOutput">
<machines>
<machine name="cheyenne" compiler="gnu" category="aux_clm"/>
<machine name="cheyenne" compiler="intel" category="aux_clm"/>
</machines>
<options>
<option name="wallclock">01:40:00</option>
<option name="wallclock">02:00:00</option>
<option name="comment" >Want a debug test that tests a number of aspects of transient crops, including a new crop landunit and shifting PCT_CFT; move to CLM50 once we can get it fast enough (see bug 2391)</option>
</options>
</test>
Expand Down
1 change: 1 addition & 0 deletions cime_config/usermods_dirs/cmip6_output/user_nl_cpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
histaux_l2x1yrg = .true.
2 changes: 1 addition & 1 deletion src/biogeochem/CNDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ subroutine CNDriverNoLeaching(bounds,
dgvs_inst, cnveg_state_inst, &
cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, &
leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp, 1:nlevdecomp_full), &
froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), &
froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), &
croot_prof_patch=soilbiogeochem_state_inst%croot_prof_patch(begp:endp, 1:nlevdecomp_full), &
stem_prof_patch=soilbiogeochem_state_inst%stem_prof_patch(begp:endp, 1:nlevdecomp_full), &
totsomc_col=soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), &
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNFUNMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
frac_ideal_C_use = max(0.0_r8,1.0_r8 - (total_N_resistance-fun_cn_flex_a(ivt(p)))/fun_cn_flex_b(ivt(p)) )
! then, if the plant is very much in need of N, the C used for uptake is increased accordingly.
if(delta_CN .gt.0.and. frac_ideal_C_use.lt.1.0)then
frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p)));
frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p)))
end if
! If we have too much N (e.g. from free N retranslocation) then make frac_ideal_c_use even lower.
! For a CN delta of fun_cn_flex_c, then we reduce C expendiure to the minimum of 0.5.
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so
cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m
if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools
cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * 10._r8
cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8
cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8
else
cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m
cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNVegNitrogenFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ subroutine InitHistory(this, bounds)
ptr_patch=this%fert_patch)
end if

if (use_crop) then
if (use_crop .and. .not. use_fun) then
this%soyfixn_patch(begp:endp) = spval
call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', &
avgflag='A', long_name='soybean fixation', &
Expand Down
4 changes: 2 additions & 2 deletions src/biogeophys/CanopyTemperatureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ subroutine CanopyTemperature(bounds, &
real(r8) :: qsatgdT ! d(qsatg)/dT
real(r8) :: fac ! soil wetness of surface layer
real(r8) :: psit ! negative potential of soil
real(r8) :: hr ! relative humidity
real(r8) :: hr_road_perv ! relative humidity for urban pervious road
real(r8) :: hr ! alpha soil
real(r8) :: hr_road_perv ! alpha soil for urban pervious road
real(r8) :: wx ! partial volume of ice and water of surface layer
real(r8) :: fac_fc ! soil wetness of surface layer relative to field capacity
real(r8) :: eff_porosity ! effective porosity in layer
Expand Down
5 changes: 3 additions & 2 deletions src/biogeophys/SurfaceAlbedoMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ subroutine SurfaceAlbedoInitTimeConst(bounds)
allocate(isoicol(bounds%begc:bounds%endc))

! Determine soil color and number of soil color classes
! if number of soil color classes is not on input dataset set it to 8

call getfil (fsurdat, locfn, 0)
call ncd_pio_openfile (ncid, locfn, 0)

call ncd_io(ncid=ncid, varname='mxsoil_color', flag='read', data=mxsoil_color, readvar=readvar)
if ( .not. readvar ) mxsoil_color = 8
if ( .not. readvar ) then
call endrun(msg=' ERROR: mxsoil_color NOT on surfdata file '//errMsg(sourcefile, __LINE__))
end if

allocate(soic2d(bounds%begg:bounds%endg))
call ncd_io(ncid=ncid, varname='SOIL_COLOR', flag='read', data=soic2d, dim1name=grlnd, readvar=readvar)
Expand Down
4 changes: 0 additions & 4 deletions src/dyn_subgrid/.gitignore

This file was deleted.

26 changes: 5 additions & 21 deletions src/main/ncdio_pio.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module ncdio_pio
interface ncd_io
module procedure ncd_io_char_var0_start_glob

!DIMS 0,1
!DIMS 0
module procedure ncd_io_{DIMS}d_log_glob

!DIMS 0,1,2,3
Expand Down Expand Up @@ -1192,11 +1192,11 @@ contains
end subroutine ncd_io_char_var0_start_glob

!------------------------------------------------------------------------
!DIMS 0,1
!DIMS 0
subroutine ncd_io_{DIMS}d_log_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile)
!
! !DESCRIPTION:
! netcdf I/O of global integer variable
! netcdf I/O of global logical variable
!
! !ARGUMENTS:
class(file_desc_t) , intent(inout) :: ncid ! netcdf file id
Expand Down Expand Up @@ -1242,12 +1242,7 @@ contains
call shr_sys_abort(' ERROR: bad integer value for logical data'//errMsg(sourcefile, __LINE__))
end if
#else
allocate(idata1d(size(data)))
data = (idata1d == 1)
if ( any(idata1d /= 0 .and. idata1d /= 1) )then
call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__))
end if
deallocate(idata1d)
call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0')
#endif
endif
if (present(readvar)) readvar = varpresent
Expand All @@ -1267,18 +1262,7 @@ contains
status = pio_put_var(ncid, varid, start, count, idata1d)
deallocate(idata1d)
#else
start(1) = 1 ; count(1) = size(data)
start(2) = 1 ; count(2) = 1
if (present(nt)) start(2) = nt
allocate(idata1d(size(data)))
where( data )
idata1d = 1
elsewhere
idata1d = 0
end where
call ncd_inqvid (ncid, varname, varid, vardesc)
status = pio_put_var(ncid, varid, start, count, idata1d)
deallocate( idata1d )
call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0')
#endif

endif ! flag
Expand Down
8 changes: 4 additions & 4 deletions src/main/restFileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,10 @@ subroutine restFile_dimcheck( ncid )
call check_dim(ncid, namep, nump, msg=msg)
if ( use_fates ) call check_dim(ncid, nameCohort , numCohort, msg=msg)
end if
call check_dim(ncid, 'levsno' , nlevsno, &
msg = 'You can deal with this mismatch by rerunning with ' // &
'use_init_interp = .true. in user_nl_clm')
call check_dim(ncid, 'levgrnd' , nlevgrnd)
msg = 'You can deal with this mismatch by rerunning with ' // &
'use_init_interp = .true. in user_nl_clm'
call check_dim(ncid, 'levsno' , nlevsno, msg=msg)
call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg)
call check_dim(ncid, 'levurb' , nlevurb)
call check_dim(ncid, 'levlak' , nlevlak)

Expand Down
2 changes: 0 additions & 2 deletions src/unit_test_shr/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions src/unit_test_stubs/main/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions src/unit_test_stubs/utils/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions src/utils/.gitignore

This file was deleted.

0 comments on commit 73f47fe

Please sign in to comment.