Accompanies OnCFD Newsletter #148: "Divergence Detector"
Here's the copy-paste-able version of the function I use to detect (& end) simulations that are slowly diverging & taking up valuable cluster time.
minMaxU
{
type fieldMinMax;
libs (fieldFunctionObjects);
mode magnitude;
fields (U);
location true;
log false;
}
divergenceDetector
{
type runTimeControl;
libs (utilityFunctionObjects);
conditions
{
condition0
{
type minMax;
functionObject minMaxU;
fields (max(mag(U)));
value 1000;
mode maximum;
groupID 1;
}
condition1
{
type equationMaxIter;
fields (p);
threshold 100;
groupID 1;
}
}
}
Save as system/divergenceDetector
& reference it in the functions
section of your controlDict
For more info - see the original article 👋