From 4ecd1126e1235bd96fb0a09964adce6cf529d7a3 Mon Sep 17 00:00:00 2001 From: Diana Gergel Date: Tue, 14 May 2019 14:07:06 -0700 Subject: [PATCH 1/2] fixes for exact restarts and a few lines of cleanup --- vic/drivers/cesm/src/cesm_put_data.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vic/drivers/cesm/src/cesm_put_data.c b/vic/drivers/cesm/src/cesm_put_data.c index efb37311f..4a077ac79 100644 --- a/vic/drivers/cesm/src/cesm_put_data.c +++ b/vic/drivers/cesm/src/cesm_put_data.c @@ -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 @@ -146,7 +146,7 @@ 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]); @@ -154,17 +154,17 @@ vic_cesm_put_data() // 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]; // evaporation, VIC: mm, CESM: kg m-2 s-1 - l2x_vic[i].l2x_Fall_evap += -1 * out_data[i][OUT_EVAP][0] / + l2x_vic[i].l2x_Fall_evap = (double) -1 * out_data[i][OUT_EVAP][0] / 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; @@ -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])); } } From a5f6ec058a82dfe860eb1c35a23ba18fc6be0d7a Mon Sep 17 00:00:00 2001 From: Diana Gergel Date: Tue, 14 May 2019 14:26:26 -0700 Subject: [PATCH 2/2] small syntax fixes --- vic/drivers/cesm/src/cesm_put_data.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vic/drivers/cesm/src/cesm_put_data.c b/vic/drivers/cesm/src/cesm_put_data.c index 4a077ac79..878d8b356 100644 --- a/vic/drivers/cesm/src/cesm_put_data.c +++ b/vic/drivers/cesm/src/cesm_put_data.c @@ -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 = (double) -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 = (double) -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 = (double) -1 * out_data[i][OUT_SENSIBLE][0]; + l2x_vic[i].l2x_Fall_sen = (double) (-1 * out_data[i][OUT_SENSIBLE][0]); // evaporation, VIC: mm, CESM: kg m-2 s-1 - l2x_vic[i].l2x_Fall_evap = (double) -1 * out_data[i][OUT_EVAP][0] / - global_param.dt; + l2x_vic[i].l2x_Fall_evap = (double) (-1 * out_data[i][OUT_EVAP][0] / + global_param.dt); // lnd->rtm input fluxes - l2x_vic[i].l2x_Flrl_rofliq = (double) (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