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

fixes for exact restarts and a few lines of cleanup #873

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions vic/drivers/cesm/src/cesm_put_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ vic_cesm_put_data()
// that is already in the put_data routine

// temperature, VIC: K, CESM: K
l2x_vic[i].l2x_Sl_t = out_data[i][OUT_RAD_TEMP][0];
l2x_vic[i].l2x_Sl_t = (double) out_data[i][OUT_RAD_TEMP][0];

// albedo, VIC: fraction, CESM: fraction
// Note: VIC does not partition its albedo, thus all types are
Expand Down Expand Up @@ -146,27 +146,27 @@ vic_cesm_put_data()

// longwave up, VIC: W/m2, CESM: W/m2
// adjust sign for CESM sign convention
l2x_vic[i].l2x_Fall_lwup = -1 *
l2x_vic[i].l2x_Fall_lwup = (double) (-1 *
(out_data[i][OUT_LWDOWN][0] -
out_data[i][OUT_LWNET][0]);
out_data[i][OUT_LWNET][0]));

// turbulent heat fluxes
// Note: both are the opposite sign from image driver
// in accordance with the sign convention for coupled models
// latent heat, VIC: W/m2, CESM: W/m2
l2x_vic[i].l2x_Fall_lat = -1 * out_data[i][OUT_LATENT][0];
l2x_vic[i].l2x_Fall_lat = (double) (-1 * out_data[i][OUT_LATENT][0]);

// sensible heat, VIC: W/m2, CESM: W/m2
l2x_vic[i].l2x_Fall_sen += -1 * out_data[i][OUT_SENSIBLE][0];
l2x_vic[i].l2x_Fall_sen = (double) (-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.

Why did you change the += to = here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was leftover from when we were aggregating over bands - since we don't do that anymore, there's no reason to have the +=.


// evaporation, VIC: mm, CESM: kg m-2 s-1
l2x_vic[i].l2x_Fall_evap += -1 * out_data[i][OUT_EVAP][0] /
global_param.dt;
l2x_vic[i].l2x_Fall_evap = (double) (-1 * out_data[i][OUT_EVAP][0] /
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change the += to = here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above - this is leftover from when we were aggregating over bands.

global_param.dt);

// lnd->rtm input fluxes
l2x_vic[i].l2x_Flrl_rofliq = (out_data[i][OUT_RUNOFF][0] +
l2x_vic[i].l2x_Flrl_rofliq = (double) ((out_data[i][OUT_RUNOFF][0] +
out_data[i][OUT_BASEFLOW][0]) /
global_param.dt;
global_param.dt);


// running sum to make sure we get the full grid cell
Expand Down Expand Up @@ -237,21 +237,21 @@ vic_cesm_put_data()
// CESM units: N m-2
wind_stress_x = out_data[i][OUT_DENSITY][0] *
x2l_vic[i].x2l_Sa_u / aero_resist;
l2x_vic[i].l2x_Fall_taux += AreaFactor * wind_stress_x;
l2x_vic[i].l2x_Fall_taux += (double) (AreaFactor * wind_stress_x);

// wind stress, meridional
// CESM units: N m-2
wind_stress_y = out_data[i][OUT_DENSITY][0] *
x2l_vic[i].x2l_Sa_v / aero_resist;
l2x_vic[i].l2x_Fall_tauy += AreaFactor * wind_stress_y;
l2x_vic[i].l2x_Fall_tauy += (double) (AreaFactor * wind_stress_y);

// friction velocity
// CESM units: m s-1
wind_stress =
sqrt(pow(wind_stress_x, 2) + pow(wind_stress_y, 2));
l2x_vic[i].l2x_Sl_fv += AreaFactor *
l2x_vic[i].l2x_Sl_fv += (double) (AreaFactor *
sqrt(wind_stress /
out_data[i][OUT_DENSITY][0]);
out_data[i][OUT_DENSITY][0]));
}
}

Expand Down