[petsc-users] User Defined KSP Method in Fortran

Matthew Knepley knepley at gmail.com
Wed Jan 22 16:11:35 CST 2025


On Wed, Jan 22, 2025 at 3:18 PM Frank Bramkamp <bramkamp at nsc.liu.se> wrote:

> Dear PETSc team,
>
> I was planning to program a custom KSP method, some modified GMRES.
> We mainly use PETSc from Fortran. Therefore I wonder it is possible
> to have an interface to a custom KSP solver that is written in fortran.
>
> I thought of using KSPRegister to register my own routine, but that seems
> only
> available in C.  Or is it possible to have a fortran/C wrapper to do that ?
>

We have wrappers for other functions that take callbacks, such as
SNESSetFunction(). What
we need to do is have a list of Fortran function pointers for this method.
They when you
register, we actually stick in a C wrapper that calls your Fortran function
pointer that we have
stored in our list. It should be straightforward looking at the
implementation for something like
SNESSetFunction(). We would help if you want to try :)

Barry, is this impacted by your binding rewrite?

  Thanks,

      Matt


> Thanks, Frank Bramkamp
>
>
>
>
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!eRXZvRoV2JfqzeOdQlhP6UA71kWfULNX_F1C0-Fer5IItdUKkmstwIO3N1VrmApHJYGGisuS6EyybVTqmo4R$  <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!eRXZvRoV2JfqzeOdQlhP6UA71kWfULNX_F1C0-Fer5IItdUKkmstwIO3N1VrmApHJYGGisuS6EyybdCUXUwi$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250122/3ab0e2ca/attachment.html>


More information about the petsc-users mailing list