You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(prt): add developer option for cycle detection (#2435)
Cyclic particle pathlines may be legitimate over multiple time steps, but within a given application of the tracking method i.e. in a single time step they so far reliably indicate a programming error.
Add a developer option DEV_CYCLE_DETECTION_WINDOW to PRT PRP enabling cycle detection. Disabled (set to 0) by default. When enabled, look at the last DEV_CYCLE_DETECTION_WINDOW events and terminate the simulation with error if a cycle is found. A cycle is defined as a duplicate cell exit (i.e. through the same face) within a single application of the tracking method.
For a speed improvement we could keep a HashTable alongside the list of recent events, where the key is the event string, then just a single lookup instead of iterating over the full window. But since this is meant for infrequent use as a developer debugging tool not a user option, and the window will be small, I will punt performance optimization for now.
Consequentially, this PR also makes it the responsibility of the event firer to deallocate the event when it's no longer needed. The event firing routines generally now deallocate the event after dispatch/handling. When cycle detection is off, the cell exit event firing routine does the same. When cycle detection is on, events cannot be deallocated until they are popped from the history, so they are cleaned up at that time by the list node's value destruction mechanism.
Copy file name to clipboardExpand all lines: doc/ReleaseNotes/develop.toml
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ description = "Fixed a memory access exception that can occur when writing conve
51
51
[[items]]
52
52
section = "features"
53
53
subsection = "solution"
54
-
description = "Added an optional new COORDINATE\\_CHECK\\_METHOD option to the PRT model's Particle Release Package, accepting values 'EAGER' (default) or 'NONE'. 'NONE' disables release-time verification that release point coordinates and release point cell IDs match, which can significantly reduce runtime when releasing many particles."
54
+
description = "Added an optional new COORDINATE\\_CHECK\\_METHOD option to the PRT model's Particle Release Package, accepting values EAGER (default) or NONE. NONE disables release-time verification that release point coordinates and release point cell IDs match, which can significantly reduce runtime when releasing many particles."
55
55
56
56
[[items]]
57
57
section = "features"
@@ -72,3 +72,8 @@ description = "Previously the Particle Tracking (PRT) Model's generalized DISV t
72
72
section = "fixes"
73
73
subsection = "basic"
74
74
description = "Previously the NOCHECK option was used to directly set the internal isimcheck variable. When NOCHECK is specified in the simulation name file isimcheck should be set to 0, otherwise isimcheck should be 1. The code has been fixed to implement the intended behaviour."
75
+
76
+
[[items]]
77
+
section = "features"
78
+
subsection = "solution"
79
+
description = "Added a developer option DEV\\_CYCLE\\_DETECTION\\_WINDOW to the PRT Model's Particle Release (PRP) Package. When enabled, this feature maintains a history of recent cell transitions, the size of which is configurable. If a cycle is detected, the program will terminate with an error. A cycle is identified as a duplicate particle event within a single application of the tracking loop, respective to certain particle and cell properties, e.g., exiting through the same cell face twice. This option defaults to 0, disabling cycle detection by default."
description approach for verifying that release point coordinates are in the cell with the specified ID. By default, release point coordinates are checked at release time.
294
294
default eager
295
295
296
+
block options
297
+
name dev_cycle_detection_window
298
+
type integer
299
+
reader urword
300
+
optional true
301
+
mf6internal icycwin
302
+
longname cycle detection window size
303
+
description integer value defining the size of the window (number of consecutive exit events) used for cycle detection. Defaults to 0, disabling cycle detection. With detection enabled, particle pathlines with duplicate cell exit events (i.e., exiting the same cell through the same face twice) will cause the program to terminate with an error. A larger window size provides more robust cycle detection at the cost of more runtime operations per cell exit.
0 commit comments