<div dir="ltr">You may take a look at our Fortran examples, e.g.,<div>petsc/src/snes/examples/tutorials/ex5f90t.F</div><div><br></div><div>Hong<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 8, 2016 at 7:31 AM, 최경준 <span dir="ltr"><<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, my name is Michael Choi, currently working on applying SNES solver to my compressible Euler equation solver with Fortran90 language.<div><br></div><div>I'm having an error like below</div><div><br></div><div><div>[0]PETSC ERROR: ------------------------------<wbr>------------------------------<wbr>------------</div><div>[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</div><div>[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</div><div>[0]PETSC ERROR: or see <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html#<wbr>valgrind</a></div><div>[0]PETSC ERROR: or try <a href="http://valgrind.org" target="_blank">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors</div><div>[0]PETSC ERROR: likely location of problem given in stack below</div><div>[0]PETSC ERROR: --------------------- Stack Frames ------------------------------<wbr>------</div><div>[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,</div><div>[0]PETSC ERROR: INSTEAD the line number of the start of the function</div><div>[0]PETSC ERROR: is given.</div></div><div><br></div><div><br></div><div>I think my problem occurs at the position below.</div><div><br></div><div>SNESSetFunction(SNES snes, Vec r, SNESFunction, ctx)</div><div><br></div><div>and SNESFunction has the form like this.</div><div>--> SNESFunction(SNES snes, Vec x, Vec f, ctx)</div><div><br></div><div>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.</div><div><br></div><div>I tried using type pointer like below</div><div>type(t_Collect) :: Collect</div><div>Collect%pGrid => Grid</div><div>Collect%pConfig => Config</div><div>Collect%pMixture => Mixture</div><div><br></div><div>I tried but pointers can not pass the SNESFunction argument.</div><div><br></div><div><br></div><div>In this kind of situation, what should I have to do??</div></div>
</blockquote></div><br></div></div></div>