I’m working on phase-field models for metal microstructure evolution. One goal is to combine experiments and simulations from this paper “Phase field modeling of rapid resolidification of Al-Cu thin films”. And this interface to PETSc will be further used to interface with the FEniCS C++ library for solving PDEs with automatic tangent and adjoint equations.
Interesting. Some people would like the “official” foreign-function-interface declared in Stan somehow. I think FFI is already there up to normal C++ usage such as including headers and linking object files since with the adj_jac_apply
and reverse_pass_callback
external functions do not need to interact with Stan autodiff types, only conversions to and from Eigen arrays are needed.
It took too much time for me to realize that and the end result doesn’t contain much code Comparing stan-dev:develop...IvanYashchuk:stan-petsc · stan-dev/math · GitHub
Taking this work as a template, we can see that getting something connected to C/C++/Fortran/Julia and running some specialized example probably won’t take much effort. The problem is in generalizing the approach and putting more responsibility on the user as it departs from the probabilistic programming way of using ready-made blocks.