Skip to content

Commit

Permalink
Merge branch 'misc_bugfixes'
Browse files Browse the repository at this point in the history
Miscellaneous minor, bit-for-bit bug fixes

Four miscellaneous minor, bit-for-bit bug fixes:

(1) Py3 pylint check and address cime issue ESMCI/cime#2822 (from Jim
    Edwards: ESCOMP#526)

(2) Change uppercase DEBUG variables to lowercase debug (requested by
    Jim Edwards to avoid conflicting with the DEBUG CPP token)
    (Fixes ESCOMP#534)

(3) Remove unnecessary line of code in LunaMod.F90 that was causing
    problems with some compilers due to an uninitialized variable
    (Fixes ESCOMP#322)

(4) Add r8 to 0 constant to fix build issue with XLF compiler (from Jim
    Edwards: ESCOMP#531)
  • Loading branch information
billsacks committed Oct 26, 2018
2 parents 8901c9e + c54566e commit 40e4d42
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
build clm library
"""
import sys, os, time, filecmp, shutil, imp
import sys, os, shutil, imp

_CIMEROOT = os.environ.get("CIMEROOT")
if _CIMEROOT is None:
Expand Down
30 changes: 14 additions & 16 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
CLM namelist creator
"""
import sys, os, time, shutil, re, imp, filecmp
import sys, os, shutil, imp, filecmp

_CIMEROOT = os.environ.get("CIMEROOT")
if _CIMEROOT is None:
Expand Down Expand Up @@ -46,7 +46,6 @@ def buildnml(case, caseroot, compname):
clm_force_coldstart = case.get_value("CLM_FORCE_COLDSTART")
lnd_tuning_mode = case.get_value("LND_TUNING_MODE")
clm_accelerated_spinup = case.get_value("CLM_ACCELERATED_SPINUP")
comp_glc = case.get_value("COMP_GLC")
comp_atm = case.get_value("COMP_ATM")
lnd_grid = case.get_value("LND_GRID")
lnd_ncpl = case.get_value("LND_NCPL")
Expand All @@ -62,14 +61,6 @@ def buildnml(case, caseroot, compname):
glc_nec = case.get_value("GLC_NEC")
mask = case.get_value("MASK_GRID")

# -----------------------------------------------------
# Clear out old data
# -----------------------------------------------------

input_data_list = os.path.join(caseroot,"Buildconf","clm.input_data_list")
if os.path.exists(input_data_list):
os.remove(input_data_list)

# -----------------------------------------------------
# Set clmconf
# -----------------------------------------------------
Expand Down Expand Up @@ -133,10 +124,10 @@ def buildnml(case, caseroot, compname):
if run_type == "branch":
startfile_type = "nrevsn"
if clm_force_coldstart == "on":
clm_force_coldstart = "off"
logger.warning( "WARNING: You've turned on CLM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" +
" turn off CLM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning"
)
clm_force_coldstart = "off"
logger.warning( "WARNING: You've turned on CLM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" +
" turn off CLM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning")


if (clm_force_coldstart == "on"):
logger.warning( "WARNING: CLM is starting up from a cold state" )
Expand Down Expand Up @@ -168,9 +159,9 @@ def buildnml(case, caseroot, compname):
usecase = ""

if ( (mask != "null") and (mask != "UNSET") ):
gridmask = "-mask %s" %mask
gridmask = "-mask %s" %mask
else:
gridmask = ""
gridmask = ""

start_ymd = run_startdate.replace('-','')

Expand All @@ -191,6 +182,13 @@ def buildnml(case, caseroot, compname):

config_cache_file = os.path.join(caseroot,"Buildconf","clmconf","config_cache.xml")

# -----------------------------------------------------
# Clear out old data
# -----------------------------------------------------

if os.path.exists(inputdata_file):
os.remove(inputdata_file)

# -----------------------------------------------------
# loop over instances
# -----------------------------------------------------
Expand Down
140 changes: 140 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,144 @@
===============================================================
Tag name: ctsm1.0.dev014
Originator(s): sacks (Bill Sacks)
Date: Fri Oct 26 06:20:34 MDT 2018
One-line Summary: Miscellaneous minor, bit-for-bit bug fixes

Purpose of changes
------------------

Four miscellaneous minor, bit-for-bit bug fixes:

(1) Py3 pylint check and address cime issue ESMCI/cime#2822 (from Jim
Edwards: ESCOMP/ctsm#526)

(2) Change uppercase DEBUG variables to lowercase debug (requested by
Jim Edwards to avoid conflicting with the DEBUG CPP token)
(Fixes ESCOMP/ctsm#534)

(3) Remove unnecessary line of code in LunaMod.F90 that was causing
problems with some compilers due to an uninitialized variable
(Fixes ESCOMP/ctsm#322)

(4) Add r8 to 0 constant to fix build issue with XLF compiler (from Jim
Edwards: ESCOMP/ctsm#531)


Bugs fixed or introduced
------------------------

Issues fixed (include CTSM Issue #):
- Fixes ESCOMP/ctsm#322 (ERS_D_Ld5.f19_g16.I2000Clm50BgcCruGs run FAIL (intel))
- Fixes ESCOMP/ctsm#534 (Rename DEBUG to debug in a few places)


Significant changes to scientifically-supported configurations
--------------------------------------------------------------

Does this tag change answers significantly for any of the following physics configurations?
(Details of any changes will be given in the "Answer changes" section below.)

[Put an [X] in the box for any configuration with significant answer changes.]

[ ] clm5_0

[ ] clm4_5

[ ] clm4_0

Notes of particular relevance for users
---------------------------------------

Caveats for users (e.g., need to interpolate initial conditions): none

Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none

Changes made to namelist defaults (e.g., changed parameter values): none

Changes to the datasets (e.g., parameter, surface or initial files): none

Substantial timing or memory changes: none

Notes of particular relevance for developers: (including Code reviews and testing)
---------------------------------------------
NOTE: Be sure to review the steps in ../CTSMMasterChecklist 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: different pieces reviewed by different people


CTSM testing:

[PASS means all tests PASS and OK means tests PASS other than expected fails.]

build-namelist tests:

cheyenne - not run

unit-tests (components/clm/src):

cheyenne - pass

tools-tests (components/clm/test/tools):

cheyenne - not run

PTCLM testing (components/clm/tools/shared/PTCLM/test):

cheyenne - not run

regular tests (aux_clm):

cheyenne_intel ---- ok
cheyenne_gnu ------ ok
hobart_nag -------- ok
hobart_pgi -------- ok
hobart_intel ------ ok

ok means tests and baseline comparisons pass. There were unexpected
NLCOMP diffs. From spot-checking a few tests, I see the following:


(1) On both cheyenne and hobart: Diffs in logfile. This looks like a
problem in cime: it says:

BASE: logfile = 'rof.log.136342.hobart.cgd.ucar.edu
COMP: logfile = 'rof.log

(2) On hobart: Diffs in pio_typename: netcdf vs. pnetcdf (says that
new uses pnetcdf): but when I compare files by hand, they look
the same in this respect (both baseline and new use netcdf), so
maybe this is due to a problem in the timing of when nlcomp is
run?

Since these both look like problems in the comparison script rather
than in the tag, I'm letting these go, but will open a cime issue if
we see this again.


CTSM tag used for the baseline comparisons: ctsm1.0.dev013


Answer changes
--------------

Changes answers relative to baseline: NO


Detailed list of changes
------------------------

List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none

Pull Requests that document the changes (include PR ids):
- https://github.com/ESCOMP/ctsm/pull/531 (fix build issue with xlf compiler)
- https://github.com/ESCOMP/ctsm/pull/526 (fix cime issue 2822 and pylint chk)

===============================================================
===============================================================
Tag name: ctsm1.0.dev013
Originator(s): erik (Erik Kluzek)/slevisconsulting
Date: Thu Oct 25 18:09:47 MDT 2018
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeSum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tag Who Date Summary
============================================================================================================================
ctsm1.0.dev014 sacks 10/26/2018 Miscellaneous minor, bit-for-bit bug fixes
ctsm1.0.dev013 erik 10/25/2018 Fix the fact that transient Bgc and SP cases had constant crop area in time
ctsm1.0.dev012 erik 09/29/2018 Add snow-free fields for snowmip, fix several issues
ctsm1.0.dev011 sacks 09/12/2018 Add water tracer consistency checks, and other water tracer work
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CropType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ subroutine CropUpdateAccVars(this, bounds, t_ref2m_patch, t_soisno_col)

call extract_accum_field ('GDDPLANT', rbufslp, nstep)
do p = begp,endp
rbufslp(p) = max(0.,this%gddplant_patch(p)-rbufslp(p))
rbufslp(p) = max(0.0_r8,this%gddplant_patch(p)-rbufslp(p))
end do
call update_accum_field ('GDDPLANT', rbufslp, nstep)
do p = begp,endp
Expand Down
8 changes: 3 additions & 5 deletions src/biogeophys/LunaMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ module LunaMod
! PRIVATE MEMBER FUNCTIONS:
public :: LunaReadNML !subroutine to read in the Luna namelist
public :: Update_Photosynthesis_Capacity !subroutine to update the canopy nitrogen profile
public :: NitrogenAllocation !subroutine to update the Vcmax25 and Jmax25 at the leaf level
public :: Acc24_Climate_LUNA !subroutine to accumulate 24 hr climates
public :: Acc240_Climate_LUNA !subroutine to accumulate 10 day climates
public :: Clear24_Climate_LUNA !subroutine to clear 24 hr climates
private :: NitrogenAllocation !subroutine to update the Vcmax25 and Jmax25 at the leaf level
private :: NUEref !Calculate the Nitrogen use effieciency based on reference CO2 and leaf temperature
private :: NUE !Calculate the Nitrogen use effieciency based on current CO2 and leaf temperature
private :: JmxTLeuning !Calculate the temperature response for Jmax, based on Leunning 2002 Plant, Cell & Environment
Expand Down Expand Up @@ -367,7 +367,7 @@ subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, &
PNcbold = 0.0_r8
call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, &
tair10, tleafd10, tleafn10, &
Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNstoreold, PNlcold, PNetold, PNrespold, &
Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNlcold, PNetold, PNrespold, &
PNcbold, PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt)
vcmx25_opt= PNcbopt * FNCa * Fc25
jmx25_opt= PNetopt * FNCa * Fj25
Expand Down Expand Up @@ -756,7 +756,7 @@ end subroutine Clear24_Climate_LUNA
!Use the LUNA model to calculate the Nitrogen partioning
subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, &
Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp,&
PNstoreold, PNlcold, PNetold, PNrespold, PNcbold, &
PNlcold, PNetold, PNrespold, PNcbold, &
PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt)
implicit none
real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf)
Expand All @@ -775,7 +775,6 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR
real(r8), intent (in) :: Jmaxb1 !coefficient determining the response of electron transport rate to light availability (unitless)
real(r8), intent (in) :: Wc2Wjb0 !the baseline ratio of rubisco-limited rate vs light-limited photosynthetic rate (Wc:Wj)
real(r8), intent (in) :: relhExp !specifies the impact of relative humidity on electron transport rate (unitless)
real(r8), intent (in) :: PNstoreold !old value of the proportion of nitrogen allocated to storage (unitless)
real(r8), intent (in) :: PNlcold !old value of the proportion of nitrogen allocated to light capture (unitless)
real(r8), intent (in) :: PNetold !old value of the proportion of nitrogen allocated to electron transport (unitless)
real(r8), intent (in) :: PNrespold !old value of the proportion of nitrogen allocated to respiration (unitless)
Expand Down Expand Up @@ -848,7 +847,6 @@ subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PAR

call NUEref(NUEjref, NUEcref, Kj2Kcref)
theta_cj = 0.95_r8
Nstore = PNstoreold * FNCa !proportion of storage nitrogen in functional nitrogen
Nlc = PNlcold * FNCa !proportion of light capturing nitrogen in functional nitrogen
Net = PNetold * FNCa !proportion of light harvesting (electron transport) nitrogen in functional nitrogen
Nresp = PNrespold * FNCa !proportion of respirational nitrogen in functional nitrogen
Expand Down
4 changes: 2 additions & 2 deletions src/biogeophys/SurfaceRadiationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module SurfaceRadiationMod
implicit none
private

logical :: DEBUG = .false. ! for debugging this module
logical, parameter :: debug = .false. ! for debugging this module

!
! !PUBLIC MEMBER FUNCTIONS:
Expand Down Expand Up @@ -977,7 +977,7 @@ subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, &
g = patch%gridcell(p)

if(elai(p)==0.0_r8.and.fabd(p,1)>0._r8)then
if ( DEBUG ) write(iulog,*) 'absorption without LAI',elai(p),tlai(p),fabd(p,1),p
if ( debug ) write(iulog,*) 'absorption without LAI',elai(p),tlai(p),fabd(p,1),p
endif
! Solar incident

Expand Down
8 changes: 4 additions & 4 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module CLMFatesInterfaceMod
! developer will at least question its usage (RGK)
private :: hlm_bounds_to_fates_bounds

logical :: DEBUG = .false.
logical :: debug = .false.

character(len=*), parameter, private :: sourcefile = &
__FILE__
Expand Down Expand Up @@ -367,7 +367,7 @@ subroutine init(this, bounds_proc )
! Check through FATES parameters to see if all have been set
call set_fates_ctrlparms('check_allset')

if(DEBUG)then
if(debug)then
write(iulog,*) 'clm_fates%init(): allocating for ',nclumps,' threads'
end if

Expand Down Expand Up @@ -402,15 +402,15 @@ subroutine init(this, bounds_proc )
s = s + 1
collist(s) = c
this%f2hmap(nc)%hsites(c) = s
if(DEBUG)then
if(debug)then
write(iulog,*) 'clm_fates%init(): thread',nc,': found column',c,'with lu',l
write(iulog,*) 'LU type:', lun%itype(l)
end if
endif

enddo

if(DEBUG)then
if(debug)then
write(iulog,*) 'clm_fates%init(): thread',nc,': allocated ',s,' sites'
end if

Expand Down
2 changes: 1 addition & 1 deletion src/utils/clmfates_paraminterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module CLMFatesParamInterfaceMod
private :: SetParameterDimensions
private :: GetUsedDimensionSizes

logical :: DEBUG = .false.
logical :: debug = .false.

character(len=*), parameter, private :: sourcefile = &
__FILE__
Expand Down

0 comments on commit 40e4d42

Please sign in to comment.