[petsc-users] SNESSetFunction

Reza Yaghmaie reza.yaghmaie2 at gmail.com
Mon Aug 17 11:46:35 CDT 2015


Hi,

I have problems with passing variables through  *SNESSetFunction* in my
code. basically I have the following subroutines in the main body of the
Fortran code. Could you provide some insight on how to transfer variables
into the residual calculation routine (*FormFunction1*)?

Thanks,
Reza
------------------------------------------------------------------------------------------------------------------
*main code*

*SNES*      snes
*Vec*          xvec,rvec
*external*   FormFunction1
*real*8*       variable1(10),variable2(20,20),variable3(30),variable4(40,40)


      call *SNESSetFunction*(snes,rvec,FormFunction1,
     & PETSC_NULL_OBJECT,
     & variable1,variable2,variable3,variable4,
     & ierr)

      end

      subroutine *FormFunction1*(snes,XVEC,FVEC,
     & dummy,
     & varable1,varable2,varable3,varable4,
     & ierr)

*SNES*                      snes
*Vec*                         XVEC,FVEC
*PetscFortranAddr*    dummy
*real*8*
 variable1(10),variable2(20,20),variable3(30),variable4(40,40)


      return
      end
--------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150817/4ccec57d/attachment-0001.html>


More information about the petsc-users mailing list