[petsc-users] Question about SNESSetFunction - FormFunction part

Matthew Knepley knepley at gmail.com
Tue Aug 9 15:41:13 CDT 2016


On Tue, Aug 9, 2016 at 3:29 PM, 최경준 <kyungjun.choi92 at gmail.com> wrote:

> Hi, I'm currently working on FormFunction routine
>
> my subroutine goes like this
>
> --> *subroutine FormFunction(snes, x, f, userctx, ierr)*
>
> Inside the above subroutine, the problem occurs when I try to use *VecGetArrayF90(x,
> xx_v, ierr)*
>
> The error pops up with this kind of message " *Vec is locked read only* "
>

Does SNES ex5f90 run for you? If so, then there must be a problem in your
code. I would start with the
example and change it slowly until you get what you want.

  Thanks,

     Matt


> So I used *VecGetArrayReadF90*, but then I got these below
>
> [0]PETSC ERROR: ------------------------------
> ------------------------------------------
> [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> probably memory access out of range
> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
> [0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/
> documentation/faq.html#valgrind
> [0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS
> X to find memory corruption errors
> [0]PETSC ERROR: likely location of problem given in stack below
> [0]PETSC ERROR: ---------------------  Stack Frames
> ------------------------------------
> [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not
> available,
> [0]PETSC ERROR:       INSTEAD the line number of the start of the function
> [0]PETSC ERROR:       is given.
> [0]PETSC ERROR: [0] F90Array1dCreate line 50 /home/ckj/Repository/petsc-3.
> 7.3/src/sys/f90-src/f90_cwrap.c
> [0]PETSC ERROR: [0] oursnesfunction line 84 /home/ckj/Repository/petsc-3.
> 7.3/src/snes/interface/ftn-custom/zsnesf.c
> [0]PETSC ERROR: [0] SNES user function line 2144
> /home/ckj/Repository/petsc-3.7.3/src/snes/interface/snes.c
> [0]PETSC ERROR: [0] SNESComputeFunction line 2129
> /home/ckj/Repository/petsc-3.7.3/src/snes/interface/snes.c
> [0]PETSC ERROR: [0] SNESSolve_NEWTONTR line 98
> /home/ckj/Repository/petsc-3.7.3/src/snes/impls/tr/tr.c
> [0]PETSC ERROR: [0] SNESSolve line 3958 /home/ckj/Repository/petsc-3.
> 7.3/src/snes/interface/snes.c
>
>
> Please give me some help.
>
> Best regards.
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160809/127e2f02/attachment.html>


More information about the petsc-users mailing list