[petsc-dev] Sanity Check for were initial conditions are set in example ex45

Barry Smith bsmith at mcs.anl.gov
Fri Oct 31 16:57:22 CDT 2014


  The initial guess function is called only once in KSPSetUp() (which is automatically called by KSPSolve() if you don’t call it).


  if (ksp->dmActive) {
    DMKSP kdm;
    ierr = DMGetDMKSP(ksp->dm,&kdm);CHKERRQ(ierr);

    if (kdm->ops->computeinitialguess && ksp->setupstage != KSP_SETUP_NEWRHS) {
      /* only computes initial guess the first time through */
      ierr = (*kdm->ops->computeinitialguess)(ksp,ksp->vec_sol,kdm->initialguessctx);CHKERRQ(ierr);
      ierr = KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);CHKERRQ(ierr);

  It is not called inside of computing the right hand side.

  Barry


> On Oct 31, 2014, at 1:29 PM, Alletto, John M <john.m.alletto at lmco.com> wrote:
> 
> All,
> 
> Please provide me with a sanity check of where the initial conditions get set in the Laplacian program example 45
> 
> Currently I assign the initial voltages to a 3-D array called barray in  ComputeRHS, these very between 0 and 100;
> 
> I initially believed initialization was occurring in ComputeRHS, but because my final output goes from 0 to 1, I am questioning my understanding of where the initial conditions go.
> 
> Can you set me straight?
> 
> 
> 
> Thanks 
> John




More information about the petsc-dev mailing list