UW-Hydro / VIC

The Variable Infiltration Capacity (VIC) Macroscale Hydrologic Model
http://vic.readthedocs.io
MIT License
259 stars 385 forks source link

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

Open dgergel opened 5 years ago

dgergel commented 5 years ago

This PR is intended to fix our current problem with exact restarts in RASM with VIC5. For additional reference for details on which global sums are different, see #872.

The solution proposed here is explicit typecasting to double as we currently do in vic_store for writing the model state. Here I have only explicitly typecasted the fields that are failing exact restarts, we may want to do this for all fields (??).

This PR also includes two minor changes that I noticed while doing the typecasting - for latent and sensible heat we had kept the += which was a relic from when we added over bands within cesm_put_data for these fields, this isn't needed anymore since we reconfigured this to use fields directly from out_data.

dgergel commented 5 years ago

@bartnijssen I don't think that the culprit is reading from/to a statefile, since we fixed exact restarts a while back in the image driver. I think what we're dealing with is purely within the CESM driver.

I think properly initializing the l2x fields could be an issue. See ~/vic/drivers/cesm/src/vic_cesm_init_library.c for how we are initializing the l2x fields with SHR_CONST_SPVAL.

I also agree that specifying the literals is unlikely to solve the problem.

bartnijssen commented 5 years ago

Agreed on the l2x fields I will be looking at those. I am going to leave the PR open for the time being till I have had a chance to look in more detail at the initialization of the l2x fields. For the cesm driver we may need to add some additional fields to the state files for exact restarts.