<div dir="ltr">Humm, GAMG works fine form (like you said), but with MG (with or without Galerkin) on 1 or 4 procs I get:<div><br></div><div><div>[0]PETSC ERROR: KSPComputeEigenvalues() line 119 in /Users/markadams/Codes/petsc/src/ksp/ksp/interface/itfunc.c Null Pointer: Parameter # 3</div><div><br></div><div>Can you tell me exactly what you get with:</div><div><br></div><div><div style><font face="arial, sans-serif">./test1 -pc_type mg</font></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">I get:</font></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">[0]PETSC ERROR: KSPComputeEigenvalues() line 119 in /Users/markadams/Codes/petsc/src/ksp/ksp/interface/itfunc.c Null Pointer: Parameter # 3</font></div><div style><font face="arial, sans-serif">[0]PETSC ERROR: PETSC: Attaching /usr/bin/gdb to ./test1 of pid 50433 on display /tmp/launch-ikNsM1/org.macosforge.xquartz:0 on machine Macintosh-6.local</font></div><div style="font-family:arial,sans-serif;font-size:12.7272720336914px"><br></div></div><div><font face="arial, sans-serif">And, it seems that the RHS is all zeros on one processor.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I am using a debug build. Try to do the same.</font></div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 2:50 AM, Filippo Leonardi <span dir="ltr"><<a href="mailto:filippo.leonardi@sam.math.ethz.ch" target="_blank">filippo.leonardi@sam.math.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here,<br>
<br>
run this e.g. with<br>
mpirun -np 4 ./test1 -draw_pause -1 -pc_type mg -pc_mg_galerkin<br>
<br>
In Debug mode it crashes, in standard mode it fails. Using Petsc current.<br>
<br>
Run without mg and works!<br>
<br>
Hope it's not me being stupid and doing something terribly wrong!<br>
<br>
Best,<br>
Filippo<br>
<div class="HOEnZb"><div class="h5"><br>
On Monday 20 October 2014 07:29:04 Barry Smith wrote:<br>
> Can you send us the code: to <a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a> or<br>
> <a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a> ? Or something that reproduces the problem?<br>
><br>
> Barry<br>
><br>
> > On Oct 20, 2014, at 3:31 AM, Filippo Leonardi<br>
> > <<a href="mailto:filippo.leonardi@sam.math.ethz.ch">filippo.leonardi@sam.math.ethz.ch</a>> wrote:<br>
> ><br>
> > Hi,<br>
> ><br>
> > I have a very specific problem that I cannot figure out with PCMG and<br>
> > multiple solves. I got a linear system that I solve many times, with same<br>
> > matrix but different RHS. I can successfully solve the system with<br>
> > standard techniques, such as default solver or LU or PCGAMG. Even MG<br>
> > works if I destroy the ksp each time or I recompute the matrices at each<br>
> > time. But when I try and go to MG and not recomputing the matrices each<br>
> > time the solver fails. Any idea?<br>
> ><br>
> > Here some detail: the setup:<br>
> > ierr = KSPSetDMActive(ksp, PETSC_FALSE); CHKERRQ(ierr);<br>
> > ierr = KSPSetDM(ksp, da); CHKERRQ(ierr);<br>
> > ierr = KSPSetComputeOperators(ksp, ComputeMatrix, ctx); CHKERRQ(ierr);<br>
> > ierr = KSPSetComputeRHS(ksp, ComputeRHS, ctx); CHKERRQ(ierr);<br>
> > ierr = KSPSetFromOptions(ksp); CHKERRQ(ierr);<br>
> ><br>
> > Then I solve as usual, for a large number of time steps:<br>
> > ierr = KSPSolve(ksp, NULL, NULL); CHKERRQ(ierr);<br>
> > ierr = KSPGetSolution(ksp, &phi);<br>
> ><br>
> > The solver converges and does that in a reasonable number of iterations:<br>
> > Linear solve converged due to CONVERGED_RTOL iterations 7<br>
> > And ksp_view and ksp_monitor do not show any weird stuff.<br>
> ><br>
> > - Weirdly enough using any solver (for instance cg+bjacobi or gamg)<br>
> > everything works (So the matrix and RHS are working fine).<br>
> > - But the problem persists with Galerkin matrices (-pc_mg_galerkin) (So is<br>
> > not a ComputeMatrix problem).<br>
> > - If I do:<br>
> > ierr = KSPSetComputeOperators(ksp, ComputeMatrix, this); CHKERRQ(ierr);<br>
> > between each solve or destroy the ksp entirely each time the solution is<br>
> > also perfect (So is not a boundary scaling or other stuff problem).<br>
> > - If I run MG with only 2 levels (so just coarse) I also get a fine<br>
> > result.<br>
> ><br>
> > Setup RHS is called each time as expected, setup matrix is called just<br>
> > once, also as expected.<br>
> ><br>
> > The only thing I can think is that MG does not update some value that<br>
> > actually needs to be recomputed.<br>
> ><br>
> > Any idea?<br>
> ><br>
> > The solution is not that different from:<br>
> > <a href="http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/</a><br>
> > ex29.c.html<br>
> ><br>
> > Best,<br>
> > Filippo</div></div></blockquote></div><br></div>