[petsc-users] User Defined KSP Method in Fortran

Barry Smith bsmith at petsc.dev
Wed Jan 22 21:58:29 CST 2025


  I think it is best to code the modified GMRES method in C; likely, much of the current GMRES code could be reused. We'd be happy to help incorporate it into PETSc.

  Barry


> On Jan 22, 2025, at 5:11 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Wed, Jan 22, 2025 at 3:18 PM Frank Bramkamp <bramkamp at nsc.liu.se <mailto: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!fZ-M6nCWDDSrX42HCG2Hd_eMWEdTWiNP56U7piFnAZP-_DkwvSartT6C_Ioe5Aay6Q2Ts_7l_vkJQSAUzZxWHPo$  <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/b7f3e778/attachment.html>


More information about the petsc-users mailing list