You can write your own kernel if you use OpenCL!

Setup

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.

Screenshot 2026-10-30 at 9.05.46 AM.png

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.

Arguments

You can add which fields, particle attributes, and constants you want your kernel to have access to.

Screenshot 2026-10-30 at 9.09.29 AM.png

Create & Update Kernels

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.

Screenshot 2026-10-30 at 9.09.58 AM.png

Code

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

Screenshot 2026-10-30 at 9.11.28 AM.png

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.