[petsc-users] Using /src/ksp/ksp/example/tutorial/ex29.c to solve Poisson Equation Twice

Alan Wei zhenglun.wei at gmail.com
Sun Oct 2 12:04:33 CDT 2011


Dear all,
    I hope you're having a nice weekend. I'm still using this program to
solve Poisson Equations. After several discussions before, I know how to use
it in general. However, I met a problem when I want to use it twice to solve
a same Poisson Equations with two different RHS.(same boundary conditions)
1) after I've done my first computation of a Poisson equation, I use
DMMGSetKSP() again setting up another (*rhs) .
    However, I found that this DMMGSetKSP does not call the function that
makes the new (*rhs), i.e. ComputeNewRHS().
2) In the first tempt to solve the Poisson equation with old RHS, DMMGSetKSP
called the function making the old (*rhs). If I comment out the first
DMMGSetKSP(), which creates the old (*rhs), then this DMMGSetKSP, which
create the new (*rhs), can call the function making the new (*rhs)
2) I read the manual of "DMMGSetKSP" saying *For linear problems may be
called more than once, reevaluates the matrices if it is called more than
once. Call DMMGSolve<http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-3.1/docs/manualpages/DMMG/DMMGSolve.html#DMMGSolve>()
directly several times to solve with the same matrix but different right
hand sides.* Does this mean that I do not need to call DMMGSetKSP if I need
to solve the same Poisson equation with another RHS? If so, how can I pass
my new RHS to dmmg?

thanks in advance,
Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111002/fb7a3f6d/attachment.htm>


More information about the petsc-users mailing list