I wrote a component that computes reaction-diffusion like this, Reaction-Diffusion Tutorial, on a mesh. It builds on Vicente Soler and Laurent Delrieu’s work here reaction diffusion on triangular mesh - Grasshopper . Thanks guys!
I extended the inputs to take either a single value, or one for each mesh vertex, so f, k etc. can vary over the mesh just as the dir input for flow direction already does.
I used Alea 3.0.4, http://www.aleagpu.com/release/3_0_4/doc/, to do the computation on the GPU. It takes a while to initialize but then it goes fast.
Alea just needs the basic install, Community license is fine. I tried using Alea.Fody for automated memory management as they recommend, but it didn’t work so I just copied everything onto the GPU explicitly.
Installing Alea: download it using nuget or whatever they want. Put the DLLs in Rhino’s System directory, not in a subdirectory. Don’t forget to unblock them, don’t forget FSharp.Core, and put only the CUDA dll that matches your system, i.e. Windows 32, Windows 64 or Mac. Then you have to launch Rhino once as admin because Alea wants to create some folders in that directory. After that you can go back to launching normally. Lastly, to pull Alea into a component right-click it and do Manage Assemblies and point that at the dll’s, then also add “using” lines.
I could not properly install anything from Alea’s samples library, they’re all broken because they refer to some beta server that doesn’t exist anymore. But bits can be downloaded and there’s some source in each one, deeply nested in the tutorials folder, which is better than nothing if you want examples.
I didn’t do anything with this yet, but thought I’d post it while it’s fresh as an example of using Alea. I was surprised how easy it was to get it basically working. I don’t know much C# and don’t plan to ever write a lot of it, so the docs were hard for me to understand. It wasn’t fast until I figured out the memory management (profiling is your friend) but now it’s nice to see it run. 50K iterations? no problem.
reaction diffusion Alea.gh (2.0 MB)