Comparing between a PETSc matrix and a standard fortran array in compressed row format

Matthew Knepley knepley at gmail.com
Fri Aug 3 08:19:35 CDT 2007


I am guessing that you are using MATAIJ format in PETSc,
so both matrices are in the same format. How about
using MatView()? Or reading in the NSPCG matrix and
subtracting as you indicate?

  Matt

On 8/2/07, Ben Tay <zonexo at gmail.com> wrote:
> Hi,
>
> I used 2 packages to solve my poisson eqn, which is part of my NS
> unsteady solver. One is the NSPCG solver package which uses the
> compressed row format to store the A matrix. The other is PETSc. I found
> that using both solvers gave me similar answers for a number of time
> step. However, after that, the answer will suddenly change drastically
> for the PETSc case. This does not happen for the NSPCG solver.
>
> For e.g. time step 1-315, oscillating airfoil case, pressure changes
> smoothly, similar answers in both cases
>
> at time=316, pressure changes from -3.22 to -3.2 for NSPCG, but pressure
> changes from -3.21 to -60.2 for PETSc
>
> This happens when I use HYPRE's AMG or PETSc's direct solver LU.
>
> I have been trying to find out what's the cause and I can't find the
> answer in debugging. I would like to compare the values of the matrix of
> the 2 different solvers and see if there's any difference. However,
> NSPCG's matrix is in compressed row format while PETSc's one is just an
> address and it can't be viewed easily. Moreover, it's a big matrix so
> it's not possible to check by inspection. I'm thinking of subtracting
> one matrix by the other and find if it's zero. What's the best way to
> solve this problem? Btw, I'm using fortran and there's no mpi
>
> Thank you.
>
>
>


-- 
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




More information about the petsc-users mailing list