<div dir="ltr"><div dir="ltr">I am having a problem, and every solution I can think of would seem to do violence to encapsulation or to DMKSP/DMSNES.<div><br></div><div>I want to have GMG automatically work on the velocity part of Stokes. So I give</div><div><br></div><div>  -fieldsplit_velocity_pc_type mg</div><div><br></div><div>in SNES ex62. This complains that the KSP has a DM but KSPSetComputeOperator() has not been called. It is fine on the global system because SNES called that in SNESSetupMatrices(). Thus in FieldSplit, I inserted<br clear="all"><div><br></div><div><div>          {</div><div>            PetscErrorCode (*func)(KSP,Mat,Mat,void*);</div><div>            void            *ctx;</div><div><br></div><div>            ierr = DMKSPGetComputeOperators(pc->dm, &func, &ctx);CHKERRQ(ierr);</div><div>            ierr = DMKSPSetComputeOperators(dms[i],  func,  ctx);CHKERRQ(ierr);</div><div>          }</div></div><div><br></div><div>where we call KSPSetDM(). However, this does not work, because the subDM has a new DMSNES, which does not have the information about the problem.</div><div><br></div><div>Solution #1:</div><div><br></div><div>  Copy the info from the old DMSNES to the subDMSNES. This inserts a dependence between KSP and SNES which we do not want.</div><div><br></div><div>Solution #2:</div><div><br></div><div>  Have DMCreateSubDM() copy everything from the solvers. This also inserts dependencies, unless we have a "copy everything" mechanism, but is this what we want.</div><div><br></div><div>Solution #3:</div><div><br></div><div>  Rethink DMKSP/DMSNES. Is this how we should store problem information. Dave already had another problem with the organization.</div><div><br></div><div>What should be done? I have never understood this construct very well. Right now, this is holding up doing some computations I need.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div></div></div>