[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-23 Thread Jed Brown
-dm_preallocate_only http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMSetMatrixPreallocateOnly.html On Mon, Jan 23, 2012 at 15:52, Xuefei (Rebecca) Yuan wrote: > Hello all, > > There is one example that has used the > > ierr = MatSetOption(*B,MAT_IGNORE_ZERO_ENTRIES,PETSC_TRUE);CHKE

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-23 Thread Xuefei (Rebecca) Yuan
Hi, Jed, Thanks very much! Problem solved. Cheers, Rebecca On Jan 23, 2012, at 1:55 PM, Jed Brown wrote: > -dm_preallocate_only > > http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMSetMatrixPreallocateOnly.html > > On Mon, Jan 23, 2012 at 15:52, Xuefei (Rebecca) Yuan wrote: >

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-23 Thread Xuefei (Rebecca) Yuan
Hello all, There is one example that has used the ierr = MatSetOption(*B,MAT_IGNORE_ZERO_ENTRIES,PETSC_TRUE);CHKERRQ(ierr); in /src/mat/examples/tutorials/ex12.c, and this option works for this case because the matrix B is created via ierr = MatCreateSeqAIJ(PETSC_COMM_SELF,n+1,n+1,0,cnt,B);CH

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Matthew Knepley
On Fri, Jan 20, 2012 at 7:07 PM, Xuefei (Rebecca) Yuan wrote: > Here is the output: > > > > > > On Jan 20, 2012, at 5:01 PM, Matthew Knepley wrote: > > On Fri, Jan 20, 2012 at 6:55 PM, Xuefei (Rebecca) Yuan lbl.gov>wrote: > >> Hello Matt, >> >> I tried several times for 3.1-p8 and dev version by

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Matthew Knepley
On Fri, Jan 20, 2012 at 6:55 PM, Xuefei (Rebecca) Yuan wrote: > Hello Matt, > > I tried several times for 3.1-p8 and dev version by putting MatSetOption > Are you sure your entries are exactly 0.0? Matt > 1) right after creation of the matrix: > > #ifdef petscDev > ierr = DMCreateMa

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Matthew Knepley
On Fri, Jan 20, 2012 at 6:28 PM, Xuefei (Rebecca) Yuan wrote: > Hello Matt, > > I have changed the code as > > ierr = MatSetOption(jacobian, MAT_IGNORE_ZERO_ENTRIES, > PETSC_TRUE);CHKERRQ(ierr); > ierr = MatAssemblyBegin(jacobian, > MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); > ierr

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Matthew Knepley
On Fri, Jan 20, 2012 at 6:02 PM, Xuefei (Rebecca) Yuan wrote: > Hello all, > > This is a test for np=1 case of the nonzero structure of the jacobian > matrix. The jacobian matrix is created via > > ierr = > DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX, > parameters.mxfi

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
I have replace INSERT_VALUES by ADD_VALUES, ierr = MatSetValuesStencil(jacobian, 1, &row, 6, col, v, ADD_VALUES);CHKERRQ(ierr); but still cannot get rid of those zeros... Cheers, R On Jan 20, 2012, at 5:28 PM, Xuefei (Rebecca) Yuan wrote: > I did use > > ierr = MatSetValuesStencil(jacobi

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
I did use ierr = MatSetValuesStencil(jacobian, 1, &row, 13, column, value, INSERT_VALUES);CHKERRQ(ierr); so it is INSERT_VALUES. Let me try to use ADD_VALUES instead of INSERT_VALUES, and see if this will make any difference. Thanks, R On Jan 20, 2012, at 5:23 PM, Matthew Knepley wrote:

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
Here is the output: On Jan 20, 2012, at 5:01 PM, Matthew Knepley wrote: > On Fri, Jan 20, 2012 at 6:55 PM, Xuefei (Rebecca) Yuan > wrote: > Hello Matt, > > I tried several times for 3.1-p8 and dev version by putting MatSetOption > > Are you sure your entries are exactly 0.0? > >Matt

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
> On Fri, Jan 20, 2012 at 6:55 PM, Xuefei (Rebecca) Yuan > wrote: > Hello Matt, > > I tried several times for 3.1-p8 and dev version by putting MatSetOption > > Are you sure your entries are exactly 0.0? > Yes, because I have looked at the output, they are 0.00e+00. R >M

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
Hello Matt, I tried several times for 3.1-p8 and dev version by putting MatSetOption 1) right after creation of the matrix: #ifdef petscDev ierr = DMCreateMatrix(DMMGGetDM(dmmg), MATAIJ, &jacobian);CHKERRQ(ierr); #else ierr = DAGetMatrix(DMMGGetDA(dmmg), MATAIJ, &jacobian);CHKER

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
Hello Matt, I have changed the code as ierr = MatSetOption(jacobian, MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE);CHKERRQ(ierr); ierr = MatAssemblyBegin(jacobian, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); ierr = MatAssemblyEnd(jacobian, MAT_FINAL_ASSEMBLY);CHKERRQ(ierr); but still get

[petsc-users] How to simplify the nonzero structure of the jacobian matrix.

2012-01-20 Thread Xuefei (Rebecca) Yuan
Hello all, This is a test for np=1 case of the nonzero structure of the jacobian matrix. The jacobian matrix is created via ierr = DMDACreate2d(comm,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX, parameters.mxfield, parameters.myfield, PETSC_DECIDE, PETSC_DECIDE, 4, 2, 0, 0, &da);CH