Integration techniques: Impacts on Stock behavior
Posted: Sun Apr 14, 2024 10:41 pm
Hi,
I recently switched my integration technique on an hourly simulation to RK2Auto. After looking more closely at the impacts on the model, I found significant errors. I understand that the RK methods are basically midpoint Euler steps, but I wonder why they are forcing a delay in integration within Vensim. Here is a very simple stock and flow. When the dimensionless value is above 0.88, then there is no inflow. When the dimensionless value is equal to or less than 0.88, it should immediately take in stock.
Shown:
Current - Euler
Current2 - RK2Auto
Current3 - RK2Fixed
Can someone attempt a brief explanation on why this is impacting the actual behavior at timesteps? I have always thought, much like PDEs, these are supposed to take the midpoint integration at time X and then report the output at time X, rather than performing the midpoint integration at time X then reporting the output at time X+n. It seems I need to switch back to Euler, despite the inaccuracies, just to get the correct behavior at the time conditional statements are meant to integrate different inputs.
I recently switched my integration technique on an hourly simulation to RK2Auto. After looking more closely at the impacts on the model, I found significant errors. I understand that the RK methods are basically midpoint Euler steps, but I wonder why they are forcing a delay in integration within Vensim. Here is a very simple stock and flow. When the dimensionless value is above 0.88, then there is no inflow. When the dimensionless value is equal to or less than 0.88, it should immediately take in stock.
Shown:
Current - Euler
Current2 - RK2Auto
Current3 - RK2Fixed
Can someone attempt a brief explanation on why this is impacting the actual behavior at timesteps? I have always thought, much like PDEs, these are supposed to take the midpoint integration at time X and then report the output at time X, rather than performing the midpoint integration at time X then reporting the output at time X+n. It seems I need to switch back to Euler, despite the inaccuracies, just to get the correct behavior at the time conditional statements are meant to integrate different inputs.