You may take a look at our Fortran examples, e.g., petsc/src/snes/examples/tutorials/ex5f90t.F
Hong On Mon, Aug 8, 2016 at 7:31 AM, 최경준 <[email protected]> wrote: > Hi, my name is Michael Choi, currently working on applying SNES solver to > my compressible Euler equation solver with Fortran90 language. > > I'm having an error like 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. > > > I think my problem occurs at the position below. > > SNESSetFunction(SNES snes, Vec r, SNESFunction, ctx) > > and SNESFunction has the form like this. > --> SNESFunction(SNES snes, Vec x, Vec f, ctx) > > From this definition, the user-defined function context (ctx; in my case, > type variable) argument can be passed by only one argument. But I need > three different data types for calculating residual in that subroutine > SNESFunction. > > I tried using type pointer like below > type(t_Collect) :: Collect > Collect%pGrid => Grid > Collect%pConfig => Config > Collect%pMixture => Mixture > > I tried but pointers can not pass the SNESFunction argument. > > > In this kind of situation, what should I have to do?? >
