This is complaining that what is stored in that file is not a vector. How was that binary file created?
-Mike ----- Original Message ----- From: "xiaohl" <xia...@ices.utexas.edu> To: "PETSc users list" <petsc-users at mcs.anl.gov> Sent: Thursday, November 17, 2011 1:08:39 PM Subject: Re: [petsc-users] questions Hi I got the error [0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Invalid argument! [0]PETSC ERROR: Not a vector next in file! from the line "ierr = VecLoad(u,viewer); CHKERRQ(ierr);" Here is my code Vec u; ierr = DMDACreate3d(PETSC_COMM_WORLD,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,-4,-4,-4, PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1, PETSC_NULL,PETSC_NULL,PETSC_NULL,&da); CHKERRQ(ierr); ierr = DMGetGlobalVector(da,&u); CHKERRQ(ierr); ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,"permX.bin",FILE_MODE_READ,&viewer);CHKERRQ(ierr); ierr = VecLoad(u,viewer); CHKERRQ(ierr); I just followed the example "http://www.mcs.anl.gov/petsc/snapshots/petsc-dev/src/dm/examples/tutorials/ex9.c.html" Do you know what happened? Hailong On Wed, 2 Nov 2011 15:53:27 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote: > On Nov 2, 2011, at 3:42 PM, Matthew Knepley wrote: > >> On Wed, Nov 2, 2011 at 8:38 PM, xiaohl <xiaohl at ices.utexas.edu> >> wrote: >> Hi >> >> I am going to implement cell center difference method for >> u = - K grad p >> div u = f >> where p is the pressure , u is the velocity, f is the source term. >> >> my goal is to assemble the matrix and test the performance of >> different linear solvers in parallel. >> >> my question is how can I read the input file for K where K is n*n >> tensor. >> >> MatLoad() > > Hm, I think you should use a DMDA with n*n size dof and then use > VecLoad() to load the entries of K. > > Barry > >> >> second one is that do you have any similar examples? >> >> Nothing with the mixed-discretization of the Laplacian. >> >> Matt >> >> Hailong >> >> >> >> -- >> 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