[petsc-users] Question about SNESSetFunction - FormFunction part
Barry Smith
bsmith at mcs.anl.gov
Tue Aug 9 16:47:11 CDT 2016
You cannot call VecGetArrayF90() on x since x is a read only variable in this function; that is it makes no sense for you to be changing values in the x vector. You should be calling VecGetArrayReadF90() on the array since you can only read the values in the array, not change them.
Barry
> On 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 "
>
>
> 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.
>
More information about the petsc-users
mailing list