<div dir="ltr"><div>OK, I use:<br><br>  call MatConvert(a_ts%FJacobian,MATAIJ,MAT_INITIAL_MATRIX,a_ts%FJacobian2,ierr);CHKERRQ(ierr)<br></div><div><br></div><div>I added code to src/snes/examples/tutorials/ex73f90t.F90 that reproduces this error, in next.<br><br></div><div>I'll look at it.<br><br></div><div>Mark<br></div><div><br><br></div><br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 6:33 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, Apr 14, 2015 at 5:19 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Matt, in looking at MatConvert_Nest_AIJ, the code looks like it is 2 years old.<br><br></div>I need a MatConvert_Nest_MPIAIJ, should I write this or does it exist someplace?</div></div></blockquote><div><br></div></span><div>This is MPIAIJ. Look at the code.</div><div><br></div><div>  Matt</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span><font color="#888888"><br></font></span></div><span><font color="#888888">Mark<br><div><div><br><br></div></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 2:54 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Also, this is with MPI so I need MPIAIJ.  Is that supposed to work?<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 2:53 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>It looks like MatConvert is looking for "MatConvert_nest_aij_C"<br><br></div>but I see:<br><br>> git grep MatConvert_Nest<br>impls/nest/matnest.c:#define __FUNCT__ "MatConvert_Nest_AIJ"<br>impls/nest/matnest.c:PETSC_EXTERN PetscErrorCode MatConvert_Nest_AIJ(Mat A,MatType newtype,MatReuse reuse,Mat *newmat)<br><br></div>Is there a problems with "Nest" vs "nest" here?<span><font color="#888888"><br><br></font></span></div><span><font color="#888888">Mark<br><div><div><br></div></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 2:46 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>I have tried<br><br> call MatConvert(a_ts%FJacobian,MATMPIAIJ,MAT_INITIAL_MATRIX,a_ts%FJacobian2,ierr);CHKERRQ(ierr)<br><br></div>and<br><br> call MatConvert(a_ts%FJacobian,MATAIJ,MAT_INITIAL_MATRIX,a_ts%FJacobian2,ierr);CHKERRQ(ierr)<br><br></div>in 'next' and it is not finding the specialized routine.<br><br></div>I will look into it.<span><font color="#888888"><br><br></font></span></div><span><font color="#888888">Mark<br><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 1:41 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 14, 2015 at 12:40 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 14, 2015 at 12:33 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>MatNest does not support convert because it does not have a getrow.<br></div></div></blockquote><div><br></div></span><div>I think this got fixed in dev. Anyhow, this supports my contention that MatNest is a piece of shit.</div></div></div></div></blockquote><div><br></div></span><div>Use 'next', it has</div><div><br></div><div>   PETSC_EXTERN PetscErrorCode MatConvert_Nest_AIJ(Mat A,MatType newtype,MatReuse reuse,Mat *newmat)</div><div><br></div><div>so it should work.</div><div><br></div><div>   Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div>Should we use a 4 block fieldsplit?</div></blockquote><div><br></div></span><div>We give up our ability to check using exact solves, but go ahead and try it if you think it will make</div><div>the physicists happy for now.</div><div><br></div><div>  Thanks,</div><div><div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 14, 2015 at 1:26 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">OK,<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 1:25 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 14, 2015 at 12:23 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>I moved this to after the setup, which it has to do because it does not have the prefix or set options.  <br><br></div>It is not failing with not finding the IS.  Will MatNest be able to merge two matrices together like this?<br><br></div>I create a 4x4 MatNext but have just two fields in fieldSplit.</div></blockquote><div><br></div></span><div>Yep, I believe that will work. If not, just convert the MatNest to an AIJ for now with MatConvert().</div><div><br></div><div>   Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 14, 2015 at 1:18 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 14, 2015 at 12:13 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>I get an error where it looks like the number fields in field split is < 2.  Do I need to set the size?<br></div></div></blockquote><div><br></div></span><div>No, each call to SetIS() just appends to the field list.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div>I use this code but I do this before I have setup the TS.  Should I do this after I setup the TS?</div></blockquote><div><br></div></span><div>This is why I hate using the API since it is difficult to get all the setup done at the right time. First,</div><div>when you call PCFieldSplitSetIS(), is the PC type set?</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>  ! setup field split<br>  call TSGetSNES(a_ts,snes,ierr);CHKERRQ(ierr)<br>  call SNESGetKSP(snes,ksp,ierr);CHKERRQ(ierr)<br>  call KSPGetPC(ksp,pc,ierr);CHKERRQ(ierr)<span><br><br>  call MatGetSize(a_ts%mass,PETSC_NULL_INTEGER,npetsc,ierr);CHKERRQ(ierr)<br>  npetsc = 2*npetsc ! two blocks in each partition<br>  j = 0<br></span>  call ISCreateStride(w_comm,npetsc,j,ione,is,ierr);CHKERRQ(ierr)<br>  call PCFieldSplitSetIS(pc,'dt',is,ierr);CHKERRQ(ierr)<span><br>  call ISDestroy(is,ierr);CHKERRQ(ierr)<br>  j = npetsc<br></span>  call ISCreateStride(w_comm,npetsc,j,ione,is,ierr);CHKERRQ(ierr)<br>  call PCFieldSplitSetIS(pc,'aux',is,ierr);CHKERRQ(ierr)<br>  call ISDestroy(is,ierr);CHKERRQ(ierr)<br><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 12:24 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 14, 2015 at 11:16 AM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Should I just use <br><br>PetscErrorCode  VecGetSubVector(Vec X,IS is,Vec *Y)<br></div></blockquote><div><br></div></span><div>Yep, that is exactly what I use it for.</div><div><br></div><div>  Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">?<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 12:15 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I am thinking that I should create an IS that is my local part of each field and then get a "sub vector" with that somehow.  Looking into this now.<br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 12:00 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Whoop, old code still there.<br><br></div>I now have to get access to vectors somehow.<br><br></div>I now get vectors for a field and do stuff with them like:<br><br>subroutine FormIFunction(ts,t_dummy,a_XX,a_Xdot,a_FF,a_ts,ierr)<br><br>  call TSGetDM(ts,dm,ierr);CHKERRQ(ierr)<br><br>  call DMCompositeGetAccessArray(dm,a_FF,ifour,PETSC_NULL_INTEGER,Fsub,ierr);CHKERRQ(ierr)<br>  call DMCompositeGetAccessArray(dm,a_Xdot,ifour,PETSC_NULL_INTEGER,Xdotsub,ierr);CHKERRQ(ierr)<br>  one = 1d0<br>  call VecAXPY(Fsub(1),one,Xdotsub(1),ierr);CHKERRQ(ierr)<br>  call VecAXPY(Fsub(2),one,Xdotsub(2),ierr);CHKERRQ(ierr)<br>  call DMCompositeRestoreAccessArray(dm,a_Xdot,ifour,PETSC_NULL_INTEGER,Xdotsub,ierr);CHKERRQ(ierr)<br>  call DMCompositeRestoreAccessArray(dm,a_FF,ifour,PETSC_NULL_INTEGER,Fsub,ierr);CHKERRQ(ierr)<br><br>  call MatMultAdd(a_ts%FJacobian,a_XX,a_FF,a_FF,ierr);CHKERRQ(ierr)<br><br></div>I need to get rid of DMCompositeGetAccessArray.  What do I do?<br><br></div>Thanks,<br></div>Mark<br><div><div><div><br><div><br></div></div></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 11:36 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 14, 2015 at 10:35 AM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>And is this the solver (appended).<br></div></div></div></div></blockquote><div><br></div></span><div>Do not call SNESSetDM(). We are not using DM at all in this code.</div><div><br></div><div>  Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div></div>I am getting an error at this last line:<br><br><br>.seealso: SNESGetDM(), KSPSetDM(), KSPGetDM()<br>@*/<br>PetscErrorCode  SNESSetDM(SNES snes,DM dm)<br>{<br>  PetscErrorCode ierr;<br>  KSP            ksp;<br>  DMSNES         sdm;<br><br>  PetscFunctionBegin;<br>  PetscValidHeaderSpecific(snes,SNES_CLASSID,1);<br>  if (dm) {ierr = PetscObjectReference((PetscObject)dm);CHKERRQ(ierr);}<br>  if (snes->dm) {               /* Move the DMSNES context over to the new DM unless the new DM already has one */<br>    if (snes->dm->dmsnes && snes->dmAuto && !dm->dmsnes) {<br><br></div>The problem is that the argument 'dm' to this method is NULL so I get a segv at the last term of this conditional.<br><br></div><div><div><br></div><div>Mark<br></div><div><br><div><br><div><br>-adv_ts_type beuler<br>-adv_ts_monitor<br>-adv_ts_view<br>-adv_ts_max_step 1<br>-adv_snes_max_it 1                    # make >> 1 for nonlinear solve<br>-adv_snes_lag_preconditioner -1       # make > 0 to update PC<br>-adv_snes_lag_jacobian -1             # make > 0 for nonlinear Jacobian<br>-adv_snes_monitor<br>-adv_snes_converged_reason<br>-adv_ksp_monitor<br>-adv_ksp_converged_reason<br>-adv_ksp_type richardson<br>-adv_pc_type fieldsplit<br>#-adv_pc_fieldsplit_type multiplicative<span><br>-adv_pc_fieldsplit_type schur<br>-adv_pc_fieldsplit_schur_fact_type full<br>-adv_pc_fieldsplit_schur_precondition full<br></span>#-adv_pc_fieldsplit_0_fields 0,1<br>#-adv_pc_fieldsplit_1_fields 2,3<br>-adv_fieldsplit_dt_pc_type lu<br>-adv_fieldsplit_aux_pc_type lu<br>-adv_fieldsplit_dt_pc_factor_mat_solver_package superlu<br>-adv_fieldsplit_aux_pc_factor_mat_solver_package superlu<br><div class="gmail_extra"><br></div></div></div></div></div></div>
</blockquote></div></div></div><br><br clear="all"><span><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</span></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div><br></div>