<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 3, 2014 at 2:49 PM, Åsmund Ervik <span dir="ltr"><<a href="mailto:asmund.ervik@ntnu.no" target="_blank">asmund.ervik@ntnu.no</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi Matt,<br>
<br>
I'm handling the null space in the same way as ex34, that is, I remove the null space (containing just the constant functions, I think) in both ComputeRHS and ComputeMatrix.
<br></div></div></blockquote><div><br></div><div>That should be fine.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
However, I just tried commenting out those lines (MatNullSpaceCreate, MatSetNullSpace or MatNullSpaceRemove, MatNullSpaceDestroy) and that has no effect. The same happens in ex34.c, commenting out the lines fixing the null space makes no difference. Does that
make sense?<br></div></div></blockquote><div><br></div><div>It appears that the RHS in ex34 already has zero mean. Its possible for some Krylov iteration to preserve this property, but</div><div>I think if you played around with solvers you could find one that screws it up without null space removal.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
Are these examples intended to be run with some special options? I see in the makefile (e.g. runex34) that there are a lot of multigrid options, but I don't think that should matter?<br>
<br>
Also, could you confirm that ex34.c does zero Neumann BCs? The header was a bit confusing, it says u=0 but I assume it should be du/dn = 0 (zero normal derivative)?<br></div></div></blockquote><div><br></div><div>Yes, its pure Neumann. Note that this is an easy analytical solution, so you can check your example.</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-size:10pt;font-family:Tahoma">
This is with 3.4.4, by the way.<br>
<br>
Thanks,<br>
Åsmund<br>
<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>Fra:</b> Matthew Knepley [<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>]<br>
<b>Sendt:</b> 3. april 2014 15:56<br>
<b>Til:</b> Åsmund Ervik<br>
<b>Kopi:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Emne:</b> Re: [petsc-users] Trying to write Fortran version of ksp/ex34.c<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Apr 3, 2014 at 8:43 AM, Åsmund Ervik <span dir="ltr">
<<a href="mailto:asmund.ervik@ntnu.no" target="_blank">asmund.ervik@ntnu.no</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Dear PETSc users,<br>
<br>
I'm trying to write a Poisson solver in Fortran using the<br>
KSPSetComputeOperators etc. framework. When debugging this, I ended up<br>
modifying ksp/ex22.f so that it matches ksp/ex34.c. The difference<br>
between these is that ex34.c has a non-constant RHS and Neumann BCs,<br>
which is closer to what I want.<br>
</blockquote>
<div><br>
</div>
<div>If it has Neumann conditions, then it has a null space. Have you included this in</div>
<div>your solver? That can cause a residual offset.</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Now, when I run these two programs I get the following:<br>
<br>
./ex22f_mod<br>
Residual, L2 norm 1.007312<br>
Error, sup norm 0.020941<br>
Error, L1 norm 10.687882<br>
Error, L2 norm 0.340425<br>
<br>
./ex34<br>
Residual, L2 norm 1.07124e-05<br>
Error, sup norm 0.0209405<br>
Error, L1 norm 0.00618512<br>
Error, L2 norm 0.000197005<br>
<br>
but when I MatView/VecView the matrix and RHS for each example (write<br>
them to file), there is no difference. I have attached ex22f_mod.F90,<br>
any suggestions on what the error is?<br>
<br>
Once this example works, you can of course include it with PETSc.<br>
<br>
Regards,<br>
Åsmund<br>
<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v2.0.22 (GNU/Linux)<br>
Comment: Using GnuPG with Thunderbird - <a href="http://www.enigmail.net/" target="_blank">
http://www.enigmail.net/</a><br>
<br>
iQEcBAEBAgAGBQJTPWWZAAoJED+FDAHgGz19aNYIANyq9k3a5kHzTlAdybkZCYDw<br>
yKtDE5l/4iWYmNL49FH8AocHVcRivLaeJG5CGKqySFtZUXOlC9DM7rn4UmuQecni<br>
dgIQuTk0Ym+OJccHyT5xxnebpFVNrIOTpInfQaDW6dTyeL1svAMeHqslKaGepySL<br>
q/cODbgNDYgl6uumB+POMZevtlM6HPhl/1m7HofcHC9upvTRjSPqP1cg+kg+/8m2<br>
Fdie/X7PCBfShrAys94kNXNcwtbO7taauphkQGMfyl0gUd+lFATG6zrEZdDqSFlV<br>
c44GFFbxW/SRIDBXdOeX9/cy75KW5do1Sildwb6R4H/i7t6/hCJUJuss7FHjmLc=<br>
=tV3N<br>
-----END PGP SIGNATURE-----<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<br>
<br clear="all">
<div><br>
</div>
-- <br>
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener </font></span></div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>