-
Notifications
You must be signed in to change notification settings - Fork 392
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
Feature/refactor cesm put data #710
Feature/refactor cesm put data #710
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.
This looks pretty good. Please run uncrustify. There are all sorts of formatting issues. Let me know once you've sorted out the final aero-resistance issues and I'll give it a complete/final review.
vic/drivers/cesm/src/cesm_put_data.c
Outdated
@@ -68,9 +68,12 @@ vic_cesm_put_data() | |||
energy_bal_struct energy; | |||
snow_data_struct snow; | |||
veg_var_struct veg_var; | |||
extern double ***out_data; |
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 this above with the other extern
s
vic/drivers/cesm/src/cesm_put_data.c
Outdated
|
||
for (i = 0; i < local_domain.ncells_active; i++) { | ||
// Zero l2x vars (leave unused fields as MISSING values) | ||
// NOTE: I think actually we want unused fields to be | ||
// filled in with zeros, that's what we did previously |
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.
Align comments. (Run uncrustify)
vic/drivers/cesm/src/cesm_put_data.c
Outdated
l2x_vic[i].l2x_Fall_fco2_lnd = 0; | ||
// for now, uncommenting these out | ||
// because this might have been the source | ||
// of the floating point error in RFR runs |
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.
No problem uncommenting these. I don't think we need the comment here.
vic/drivers/cesm/src/cesm_put_data.c
Outdated
// Note: VIC does not partition its albedo, thus all types are | ||
// the same value | ||
// force->NetShortAtmos net shortwave flux (+ down) | ||
// SWup = force->shortwave[NR] - energy.NetShortAtmos |
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.
Do we need these last two comments?
vic/drivers/cesm/src/cesm_put_data.c
Outdated
|
||
// snow height, VIC: cm, CESM: m | ||
// convert to VIC units | ||
l2x_vic[i].l2x_Sl_snowh = out_data[i][OUT_SNOW_DEPTH][0] / CM_PER_M; |
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.
are we sure CPL/WRF isn't expecting SWE?
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.
In ~/wrf/phys/module_ra_cam.F
, it's defined as Snow depth over land, water equivalent (m)
, which is confusing wording but I take it to mean that we should be returning SWE, not snow depth - so I think you're right
vic/drivers/cesm/src/cesm_put_data.c
Outdated
// sensible heat, VIC: W/m2, CESM: W/m2 | ||
// TO-DO: check sign in VIC 4 coupling, this is inconsistent with | ||
// the history file output sign | ||
l2x_vic[i].l2x_Fall_sen += -1 * out_data[i][OUT_SENSIBLE][0]; |
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.
take care of this TODO as part of your next round of changes for this PR.
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.
Yes - it should be negative. In VIC4 we took care of the sign convention in the lnd_comp_mct.F90
routine, but I think we want to do this in the VIC driver now.
vic/drivers/cesm/src/cesm_put_data.c
Outdated
// so not repeated here | ||
evap = out_data[i][OUT_EVAP][0] * MM_PER_M; | ||
l2x_vic[i].l2x_Fall_evap += -1 * evap / | ||
global_param.dt; |
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.
do you really need this temporary evap
variable?
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 don't think so - just took it out.
@jhamman and @bartnijssen, this is ready for a full review. I'm holding off on making corresponding changes for PR #712 since they'll break the Travis tests, so I'll make those in a quick follow up PR after this and #712 have been merged. |
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 looks nice and clean. 1 small comment. We also should note this change in the change-log.
// adjust sign for CESM sign convention | ||
l2x_vic[i].l2x_Fall_lwup = -1 * | ||
(out_data[i][OUT_LWDOWN][0] - | ||
out_data[i][OUT_LWNET][0]); |
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.
Do we have a longwave up variable in out_data?
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.
Nope - we have LWDOWN
, LWNET
and the band-specific version of LWNET
in out_data
.
…IC into feature/refactor_cesm_put_data
@jhamman thanks. Just added a release notes entry. |
@bartnijssen @jhamman this should be ready to merge. |
new tests addedscience test figuresThis PR refactors the
cesm_put_data
routine in the CESM driver so that the same output data is being written to the coupler fields and the history files, barring a few sign convention differences. It also sets the dustl2x
fluxes, dry deposition velocity and MEGAN fluxes to 0, as I don't think we should be passing these with fill values to the coupler (previously in RASM we populated unused fields with zeros).A few remaining to-dos (which we may want to put in a separate PR):