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

Feature/refactor cesm put data #710

Merged
merged 20 commits into from
Jun 7, 2017

Conversation

dgergel
Copy link
Contributor

@dgergel dgergel commented Mar 30, 2017

This 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 dust l2x 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):

  • updating calculation of aerodynamical resistances
  • updating roughness and wind stresses (which depend on the aerodynamical resistances)

@dgergel dgergel self-assigned this Mar 30, 2017
Copy link
Member

@jhamman jhamman left a 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.

@@ -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;
Copy link
Member

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 externs


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align comments. (Run uncrustify)

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
Copy link
Member

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.

// 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
Copy link
Member

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?


// 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;
Copy link
Member

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?

Copy link
Contributor Author

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

// 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];
Copy link
Member

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.

Copy link
Contributor Author

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.

// 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;
Copy link
Member

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?

Copy link
Contributor Author

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.

@dgergel
Copy link
Contributor Author

dgergel commented May 2, 2017

@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.

Copy link
Member

@jhamman jhamman left a 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]);
Copy link
Member

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?

Copy link
Contributor Author

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.

@dgergel
Copy link
Contributor Author

dgergel commented May 19, 2017

@jhamman thanks. Just added a release notes entry.

@dgergel
Copy link
Contributor Author

dgergel commented Jun 5, 2017

@bartnijssen @jhamman this should be ready to merge.

@jhamman jhamman merged commit 6728d96 into UW-Hydro:develop Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants