Add the script to Simulation Flow (Ctrl/Cmd + F2) > FramesPre.
The script calculates the normals of particles of a Dyverso domain ("DY_Domain") based on their neighbours. A calculation like that can be used to detect border particles.
To get the normals it is necessary to calculate the particles' centre of gravity by adding up all position values and building an average value. This average is then compared against a threshold.
Border particle detection works best with thin sheets of fluid, e.g. a "Linear" emitter with a "Sheeter" daemon. The main problem is to find a suitable threshold.