UW-Hydro / VIC

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

Vegetation library mapping errors when using MP #864

Open BramDr opened 5 years ago

BramDr commented 5 years ago

Dear VIC managers,

I have noticed (and fixed) an error to do with the vegetation library mapping when using MP. The error is described below and the fix was done on our own version of VIC (however, the changes should be directly applicable to this version). I refer to the pull request below for the changes.

https://github.com/wietsefranssen/VIC/pull/27

"The_ vic_run_veg_lib variable is used to communicate the vegetation library (veg_lib) to other functions (canopy_evap and transpiration) using an external variable. Each cell iteration overwrites the vic_run_veg_lib variable. However, when using MP the variable is overwritten by each separate process. Therefore vegetation information could be from the a different cell currently processed by MP.

This is not a problem with the current (global) vegetation parameters of VIC, since they are the same for every cell in the simulation. However, for my personal project some parameters (e.g. LAI, veg_rough, displacement etc.) vary per cell, which causes errors.

To fix this the vic_run_veg_lib variable was deleted and the veg_lib is used directly. This also required several functions to use the vegetation library as an input directly, instead of combining the vegetation class with the vic_run_veg_lib variable.

For the image domain it would be possible to store all veg_lib parameters in the veg_con. The veg_con parameters are only allocated if vegetation is actually present, which would both decrease memory usage and remove these kinds of errors."

Hopefully this might be of help?

Sincerely, Bram Droppers PhD Wageningen University