[petsc-users] Missing Fortran interface for PetscFree?

Matthew Knepley knepley at gmail.com
Fri Feb 15 08:55:38 CST 2019


On Fri, Feb 15, 2019 at 6:26 AM Marco Tiberga via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Dear PETSc developers,
>
>
>
> Unfortunately, I need to continue the previous conversation (which I
> attached), because I am getting another compiler error.
>
> I need to call PetscFree() after PCFieldSplitGetSubKSP (I am trying to
> implement what is described in lines 117—120 of this example
> <https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex70.c.html>),
> but the compiler complains that the reference to it is undefined, even if I
> “use petscsys”.
>
>
>
> So, I was wondering whether the Fortran interface for PetscFree is missing
> as well, or if I am doing something wrong.
>

PetscMalloc() and PetscFree() cannot work for Fortran because F90 has its
own idea of pointers.

However, the Fortran binding for PCFieldSplitGetSubKSP() does not allocate
the array. Rather, you pass in an array
of the correct size and it just fills it up.

  Thanks,

     Matt

>
>
> Thanks again for the help!
>
>
>
> Best regards,
>
>
>
> Marco Tiberga
>
> PhD candidate
>
> Delft University of Technology
>
> Faculty of Applied Sciences
>
> Radiation Science & Technology Department
>
> Mekelweg 15, 2629 JB Delft, The Netherlands
>
> E-Mail: *m.tiberga at tudelft.nl <m.tiberga at tudelft.nl>*
>
> Website: http://www.nera.rst.tudelft.nl/
>
>
>
>
>
>
>
> *From:* Marco Tiberga
> *Sent:* donderdag 7 februari 2019 15:31
> *To:* 'Smith, Barry F.'
> *Cc:* petsc-users at mcs.anl.gov; Danny Lathouwers - TNW
> *Subject:* RE: [petsc-users] Missing Fortran interface for
> PCFieldSplitSetIS and PCFieldSplitGetIS?
>
>
>
> Dear Barry,
>
>
>
> Thanks a lot for your fast reply, as usual.
>
> The patch did work!
>
>
>
> With kind regards,
>
> Marco Tiberga
>
> PhD candidate
>
> Delft University of Technology
>
> Faculty of Applied Sciences
>
> Radiation Science & Technology Department
>
> Mekelweg 15, 2629 JB Delft, The Netherlands
>
> E-Mail: *m.tiberga at tudelft.nl <m.tiberga at tudelft.nl>*
>
> Website: http://www.nera.rst.tudelft.nl/
>
>
>
>
>
>
>
> *From:* Smith, Barry F. [mailto:bsmith at mcs.anl.gov]
> *Sent:* donderdag 7 februari 2019 5:19
> *To:* Marco Tiberga
> *Cc:* petsc-users at mcs.anl.gov; Danny Lathouwers - TNW
> *Subject:* Re: [petsc-users] Missing Fortran interface for
> PCFieldSplitSetIS and PCFieldSplitGetIS?
>
>
>
>
>    Marco,
>
>    We were missing a Fortran stub in the code. You can either apply the
> attached patch or use the git branch barry/add-pcfieldsplit-getis/maint for
> the missing functionality. The fix will also be in the next maintenance
> release of petsc-3.10
>
>    Please let us know if there are any difficulties.
>
>    Barry
>
>
> > On Feb 6, 2019, at 9:56 AM, Marco Tiberga via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
> >
> > Dear PETSc developers,
> >
> > I am developing a coupled solver for the incompressible Navier-Stokes
> equations, based on the PCFIELDSPLIT implemented in PETSc (I’m using
> version 3.10.1).
> > My code is written in Fortran.
> >
> > I tried to follow as much as possible this example, but I am getting
> weird errors. I think the problem is in the call to PCFieldSplitSetIS.
> > To debug the code, for each field I wanted to call PCFieldSplitGetIS
> (after setting it) and print the IS with ISView. However, the compiler says
> the reference to PCFieldSplitGetIS is undefined.
> >
> > So, I was wondering whether PCFieldSplitGetIS and PCFieldSplitSetIS are
> actually available for Fortran.
> > I tried to had a look at
> petsc-3.10.1/src/ksp/f90-mod/ftn-auto-interfaces/petscpc.h90, but I cannot
> find the interfaces for these functions.
> >
> > Thanks for the clarification.
> >
> > Best regards,
> >
> > Marco Tiberga
> > PhD candidate
> > Delft University of Technology
> > Faculty of Applied Sciences
> > Radiation Science & Technology Department
> > Mekelweg 15, 2629 JB Delft, The Netherlands
> > E-Mail: m.tiberga at tudelft.nl
> > Website: http://www.nera.rst.tudelft.nl/
>


-- 
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://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190215/d014cadf/attachment.html>


More information about the petsc-users mailing list