NREL / SOWFA-6

32 stars 35 forks source link

Fix bug with TVMIO when `offset` is specified #35

Closed ewquon closed 3 years ago

ewquon commented 3 years ago

The fix is to update refValue() with offset using +=. SOWFA-6 results with TVMIO now appear to be consistent with SOWFA-2.4.x.

(*this + offset_->value(t)) can give unexpected results--the entire TVM inflow plane gets wiped out--even when offset (0 0 0) and offset 0 are specified for U and T, respectively.

E.g., comparison of TVMIO/TVMFV on an inflow plane: compare_U_westBC_versions

ewquon commented 3 years ago

Explanation: What's happening in the previous version of the code is:

if "offset" is specified:
    refValue = value + offset

where refValue is the interpolated TVM inflow plane. This might have worked properly for TVMFV if the patch values were properly initialized the TVM values, but in our case value does not necessarily get set to refValue depending on the initial value and/or valueFraction.

mchurchf commented 3 years ago

This looks great, and my tests show that it fixes my problem.