Addition of irr_day decision table variable#207
Conversation
Signed-off-by: Galen <gisrichards@gmail.com>
Signed-off-by: Galen <gisrichards@gmail.com>
Signed-off-by: Galen <gisrichards@gmail.com>
|
I think the use case here is valid, but this new irr_day condition looks very close to an existing mechanism: days_irr. days_irr is the existing counter-based approach. It stores a single integer per HRU, increments it by 1 each day, and resets it to 1 when an irrigation event occurs. That condition is already exposed in the decision-table logic, so if you check something like days_irr > 5, the model should irrigate once the counter has climbed past 5, then reset it and start counting again.
irr_day is the timestamp-based approach added in this PR. Instead of storing the number of days since irrigation, it stores the Julian day on which the last irrigation happened. Then when the condition is evaluated, it computes the elapsed time as time%day - last_irr_day, with a wraparound adjustment for year boundaries and a special sentinel rule for the never-irrigated case.
So functionally, both approaches are representing the same concept: days_irr asks: “what is the current counter value?” in the "unlim" block in actions.f90, could we just reset days_irr when irrigation is actually applied? [actions.f90:140-165] That seems like it would address this issue while reusing the existing decision-table condition, instead of adding a second mechanism. |
|
I agree that adding additional functionality to days_irr would be the best option. I initially tried to use that variable in a decision table but it wasn't working, which led me to creating the irr_day variable. If days_irr can be modified to work with all auto irrigation decision tables/water sources/irrigation systems then that would be simpler than adding an additional variable. Also, I had Google's AI help me write the code and create this variable. I generally understand fortran and the file structure of SWAT, and have made small changes to SWAT2012 source code for my research over the past few years. This however was beyond my own coding abilities, however I think that having a decision table variable that controls days between auto-irrigations will be useful to SWAT users in irrigated regions. |
Added the decision table variable "irr_day", which when used along with auto-irrigation will not allow irrigation events to occur within a user-specified number of days. The purpose of the addition of this variable is to help simulate limitations of certain irrigation types (center pivot, wheel line, furrow) which are often set to apply greater water depths at lower frequencies.