On 02/02/2012 15:23, Jed Brown wrote: > On Thu, Feb 2, 2012 at 13:03, gouarin <loic.gouarin at math.u-psud.fr > <mailto:loic.gouarin at math.u-psud.fr>> wrote: > > It seems that I have forgotten to initialize DMSetInitialGuess, > DMSetFunction, DMSetJacobian. > > I don't understand what is the best way to use 4Q1-Q1 elements for > the Stokes problem: > > > src/ksp/ksp/examples/tutorials/ex43.c (2D) and ex42.c (3D) use these > elements for variable-viscosity Stokes. No. In those examples, you have the same grid for the velocity and the pressure. If I use 4Q1_Q1 elements, I have not the same grid. I have one for the velocity and an other for the pressure in the DMComposite. And for me, it is the difficulty because as you say after, I have to do my own preallocation step to have the good off-diagonal blocks.
This is why I asked what is the best way to construct my matrix. I hoped that now it is not necessary to do this preallocation. This is also a difficulty to use a multigrid only on the velocity. Thanks, Loic > > - Construct the matrices for each DM in the DMComposite > - Construct the global matrix and the global preconditioner > - Use MatNest > > > DMComposite can allocate for AIJ or Nest. Just set the matrix type, > e.g. -dm_mat_type nest, ex28.c does this (see runex28_3). > > But preallocation for off-diagonal blocks (of MatNest or AIJ) is still > messy and I haven't figured out a good API other than to write an > efficient dynamic preallocation to make it unnecessary. A lot of users > like Jacobian-free Newton-Krylov with the true Jacobian applied by > finite differencing (-snes_mf_operator) in which case the current code > is fine because we only assemble diagonal blocks. > > > There are a lot of possibilities with PETSc with new add-ons and > it is difficult to find our way with only the documentation. > > -- Loic Gouarin Laboratoire de Math?matiques Universit? Paris-Sud B?timent 425 91405 Orsay Cedex France Tel: (+33) 1 69 15 60 14 Fax: (+33) 1 69 15 67 18 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120202/8e9ca5c2/attachment.htm>
