[petsc-users] Re-zero sparse matrix and MatZeroEntries

Matthew Knepley knepley at gmail.com
Fri Feb 18 05:57:11 CST 2011


On Fri, Feb 18, 2011 at 5:20 AM, TAY wee-beng <zonexo at gmail.com> wrote:

> Hi,
>
> I am trying to solve the Navier Stokes momentum equation of a moving body.
>
> For most points (a), I will be using the north/south/east/west locations to
> form the equation.
>
> However, for some points (b), due to the moving body, I will be using some
> interpolation schemes. At different time step, the interpolation template
> will be different for these points. Hence, I will use different neighboring
> points to form the equation.
>
> Moreover, points (a) can change to points (b) and vice versa.
>
> I wonder if I can use MatZeroEntries to re-zero the whole sparse matrix.
> But in the manual, it states that "For sparse matrices this routine retains
> the old nonzero structure. ". However for my case, the template is different
> at different time step.
>
> Hence what is the most efficient procedure?
>

There is no efficiently, updateable data structure in PETSc, since this
would be much lower performance for general use.

I suggest using a matrix-free application of your full operator, and a fixed
sparsity operator for your preconditioner. Alternatively,
you can rebuild the matrix structure at each step, which might be the best
option depending on how much work you do in each solve.

   Matt


> --
> Yours sincerely,
>
> TAY wee-beng
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110218/2516bda6/attachment.htm>


More information about the petsc-users mailing list