> On Oct 7, 2020, at 5:02 PM, baikadi pranay <[email protected]> wrote:
> 
> Thank you Barry for the response. Just to make sure I understood correctly, I 
> do not need to define any attributes to the vectors and it is automatically 
> taken care of (both the intent as well as the allocatable attributes). Am I 
> correct?
> For the second question, my subroutine should look like this:
> FormFunction(snes,x,f,3,INTEGER_VARIABLE,ierr)
> Is this correct?
> 

   For example src/snes/tutorials/ex1f.F90

      subroutine FormFunction(snes,x,f,dummy,ierr)
      use petscsnes
      implicit none

      SNES     snes
      Vec      x,f
      PetscErrorCode ierr
      integer dummy(*)


> Thank you in advance.
> Best Regards,
> Pranay.
> 
> ᐧ
> 
> On Wed, Oct 7, 2020 at 1:26 PM Barry Smith <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> 
> > On Oct 7, 2020, at 1:41 PM, baikadi pranay <[email protected] 
> > <mailto:[email protected]>> wrote:
> > 
> > Hello,
> > I have a few questions regarding FormFunction when using the SNES solvers. 
> > I am using Fortran90. 
> > 
> > 1) I went through the example (ex1f.F90) provided in the documentation that 
> > uses Newton method to solve a two-variable system. In the subroutine 
> > FormFunction, the first argument is an input vector (x). However in the 
> > code, no attributes are specified saying that it is an input argument for 
> > the subroutine (i.e. intent attribute is not specified). Is this 
> > automatically taken care of or should I be defining the intent attribute in 
> > my code ?
> 
>   We don't currently provide attributes for our Fortran stubs, so it is best 
> if you do not mark them in your subroutines. 
> 
>   Yes the x is input only and the f is output only.
> 
> > Also, should I use the "allocatable" attribute when defining the vector x?
> 
>    I am pretty sure no.
> 
> > Please comment similarly on the output vector f as well.
> > 2) Should the ctx argument of the subroutine FormFunction be defined as 
> > "PETSC_NULL_INTEGER"?
> 
>    The context is how you convey additional information into FormFunction(). 
> Should you choose to not use it then in your function you can declare it as a 
> integer and simply not use it. If you are calling your FormFunction() from 
> Fortran then just pass a meaningless integer as that argument.  
> PETSC_NULL_INTEGER is for call PETSc functions that take integer array 
> arguments that you are not supplying.
> 
>   Barry
> 
> 
> 
> > 
> > Please let me know if you need any further information. 
> > 
> > Thank you.
> > Best Regards,
> > Pranay.
> 

Reply via email to