-
Notifications
You must be signed in to change notification settings - Fork 320
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
[CLOSED] Add hillslope scripts (to python/ctsm/) and external #2401
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work on this @samsrabin and @swensosc! Nice to see this coming in.
I have some questions, requests for changes, and things I point out to do later. I think this likely would be good to go over this.
To be honest -- I thought this might be smaller than it really was -- so I took on reviewing it. But, might not have had I realized the size. LOL. That's not bad, just a personal confession.
I do wonder if someone else should review it as well? And it might be good to just go through together. So maybe the second person doesn't do much looking beforehand, just goes through the walkthrough with us?
Externals.cfg
Outdated
local_path = tools/external/representative-hillslopes | ||
protocol = git | ||
repo_url = https://github.com/swensosc/Representative_Hillslopes | ||
tag = 06f12b6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be hash rather than tag.
They might both work, but better to use the right term.
Externals.cfg
Outdated
[representative-hillslopes] | ||
local_path = tools/external/representative-hillslopes | ||
protocol = git | ||
repo_url = https://github.com/swensosc/Representative_Hillslopes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK for now. But, in the longer run we'll want this personal fork moved to ESCOMP.
We'll also want to think about repository standards and how to handle tags and such. For a small repository like this it doesn't need to be (nor should it) be as complex as CTSM.
namelst=>"origflag=0, lower_boundary_condition=2", | ||
GLC_TWO_WAY_COUPLING=>"FALSE", | ||
phys=>"clm4_5", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add new tests for the fatal errors that hillslope error checking adds. I counted five fatal errors, so most likely that means five tests for them.
bld/CLMBuildNamelist.pm
Outdated
my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; | ||
|
||
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_hillslope' ); | ||
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'downscale_hillslope_meteorology' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the rest of these in a if statement that checks if use_hillslope is on. There's no reason to set any of these when hillslope is off.
src/main/atm2lndType.F90
Outdated
@@ -555,24 +558,25 @@ subroutine InitHistory(this, bounds) | |||
avgflag='A', long_name='atmospheric surface height', & | |||
ptr_lnd=this%forc_topo_grc) | |||
|
|||
this%forc_solar_not_downscaled_grc(begg:endg) = spval | |||
call hist_addfld1d (fname='FSDS_from_atm', units='W/m^2', & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be default output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to map what is going on here. There's some sensitivity that people have for changing history variable names because they assume them in post-processing scripts as well as in user_nl_clm files.
Can you map out the basic changes here, on what is being renamed and what is removed and added?
hillslope_pft_distribution_method = 'PftLowlandUpland' | ||
hillslope_soil_profile_method = 'Uniform' | ||
|
||
fsurdat = '$DIN_LOC_ROOT/lnd/clm2/testdata/surfdata_10x15_78pfts_simyr2000_synthetic_cosphill_1.3.nc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file will need to be updated with CTSM5.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it should have a creation date at the end. This is important for CESM since we version control files through the creation date string. You can't import a file with changes with an existing name -- as you will silently change answers for existing simulations. Obviously, that doesn't apply here, but still since we can't import a file with the same name the convention is still valid.
src/main/initVerticalMod.F90
Outdated
! The distinction between "shallow" and "deep" bedrock is not made explicitly | ||
! elsewhere. But, since these classes have somewhat different behavior, they are | ||
! distinguished explicitly here. | ||
integer, parameter :: LEVGRND_CLASS_STANDARD = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically our standard says we ONLY use uppercase for CPP tokens. But, CPP tokens are now very rare in CTSM, and that was long enough ago that we had extensive use of CPP tokens, that I think it's OK to change our standard to allow it for parameters. This is a common code convention now and it's useful.
But, we should agree to this and change the standard on the wiki.
src/main/clm_instMod.F90
Outdated
! Set hillslope column bedrock values | ||
if (use_hillslope) then | ||
call SetHillslopeSoilThickness(bounds,fsurdat, & | ||
soil_depth_lowland_in=8.5_r8,& |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the meaning of the hardcoded constants here (8.5 and 2.0)? Does it improve readability to make them a parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are used in the unit tests, as well. So it might be better to have them as parameters. The latest value doesn't need to be in the tests, but it still might be useful.
src/main/controlMod.F90
Outdated
@@ -257,6 +257,11 @@ subroutine control_init(dtime) | |||
|
|||
namelist /clm_inparm/ use_biomass_heat_storage | |||
|
|||
namelist /clm_inparm/ use_hillslope | |||
|
|||
namelist /clm_inparm/ downscale_hillslope_meteorology |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like downscale_hillslope_meteorology and use_hillslope_routing could be in the Hillslope specific namelist rather than here.
use_hillslope is an overall control variable, so needs to be here, but it looks like to me these two are only used if use_hillslope is on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By having namelist controls in the most specific location as possible, it makes it easier to change parameterization packages (add new versions, or remove old ones). The control variables at this level are kind of out of control (too many of them), so I like to make them specific if it can be done.
6ac1aee
to
bfdad6c
Compare
…es_history_dimlevel
bfdad6c
to
b722a14
Compare
Thanks @samsrabin I'll leave them here for now. We may discuss if they come up after review of the new PR. Although I'll probably make an issue of all uppercase in the FORTRAN code for constants. |
Work in progress! At risk of force pushes!
Description of changes
Sean Swenson has various scripts related to making files/variables for use in hillslope runs. Some of these are not CTSM-specific, so they're in a separate Representative_Hillslopes repo. Some are CTSM-specific, though, so this PR will add those to
python/ctsm/
. It also adds the Representative_Hillslopes repo as an optional external to CTSM.Specific notes
Contributors other than yourself, if any: Sean Swenson (@swensosc)
CTSM Issues Fixed (include github issue #):
Are answers expected to change (and if so in what way)? No
Any User Interface Changes (namelist or namelist defaults changes)? No
Testing performed, if any: None so far.