Gsoc: porting heat2d to m-file

@sarrah-basta: one thing I mentioned in the meeting, that I’ll try to articulate here.
Consider: sundials/idaHeat2D_klu.c at main · LLNL/sundials · GitHub

Around line 256 there is a function heatres. I think you could start writing that in an m-file. See also line 604, setInitialProfile. I would ignore the Jacobian functions for now. The goal here is to start setting up code to solve the same problem that you’ve been playing with but in the way an Octave user would, where they would then call ode15i.

(That doesn’t replace the other things you’re working on; but I think it will eventually help as the project continues).

Independently of that, @carandraug suggested getting your current 4-file example building within the Octave tree, even if its not in a perfect way.

Yes, thank you, I’ll try looking into recreating this example soon. To begin with this wee, I tried @carandraug’s suggestion and ported the 4 files of the custom implementations into Octave. The linking part of it wasn’t too hard, as the variables to use Sundials have already been correctly configured for, and I merely added my files as sources for the __ode15__ to build with. This might be somewhat of a temporary hack, I think I can figure out a way to do this in a more refined way with some help if needed. I then tried using those custom implementations in __ode15__ as was the plan, along with a small very simple example to test it out. However here I ran across one problem, one function that was optional in the earlier example is compulsorily called by IDALS here, and hence I would firstly require some help in regards to this question I had originally posted to @cdf , but anyone with some insight into Octave’s ColumnVector class could possibly help with :

nice work! I’m afraid that’s too deep in Octave’s internals for me! Is it possible to instead provide a custom writer function (without giving direct write access)? (as a intermediate step).

I guess you mean N_VSetArrayPointer? I’m note sure I’m reading it right. If you need a method that lets you swap the pointer itself, I don’t think that is possible (without making your own subclass). If you want a pointer that you can use to write the values to, then you can use fortran_vec().

Hi @cbm, thanks for the suggestion

Fortunately @sarrah-basta will probably not need to make here own m-file tests for ode15i, they were already created during the GSOC project of Francesco Faccio, she can just use those and save time.

I replied to this in another thread

what are those “4 files”? where are they in your repo? did you implement the custom SUNMatrix and SUNlinsolve implementations yet?

I see you removed the modified idaHeat2D_kry.c from your repo, why did you do that? How would you test the matrix and linear solver implementations?

BTW as far as the custom implementation of nvector is concerned I think the name nvector_octave is more informative from the SUNDIALS point of view than nvector_Col

Consider for example the nvector_trilinos implementation, that is a wrapper for a TpetraVectorInterface object but the implementation is named after the library it relies on,
not the class …

1 Like