You can write your own kernel if you use OpenCL!
The first thing you need to do is go to the compute advanced settings and pick the OpenCL API. Metal & Cuda are pre-compiled so you are not able to add custom kernels.
Then, enable Custom OpenCL to allow compiling and use of your custom kernels.

Order tells the solver when to run your kernel in the time step.
Run over tell the solver what entity to operate on.
The kernel name must be unique and should indicate what your kernel does.
You can add which fields, particle attributes, and constants you want your kernel to have access to.

When you have setup your arguments you can create a new kernel or update the arguments of an existing kernel so you do not loose your source code.

Once you have created your kernel you can go to the code tab to see your initial kernel code.

The OpenCL here is fairly standard however there are some special things related to the solver.
The first thing you will notice is that some arguments have a type of variableFloat_t. The solver can run in both 32-bit & 16-bit mode so this type will be defined as either be type float or half. To access values of these arguments you will need to use the special coreReadVariableFloatValue(…) & coreWriteVariableFloatValue(…) functions that automatically convert both types. You can see an example of how to use these in the default kernel code.