[petsc-dev] EXTERNAL: Re: Sanity Check for were initial conditions are set in example ex45
Barry Smith
bsmith at mcs.anl.gov
Tue Nov 4 14:36:15 CST 2014
Better to send this to everyone. I don’t have a clue what about your application.
Your computerhs is suppose to compute the right hand side of the linear system you wish to solve. I don’t know what that is.
Barry
> On Nov 3, 2014, at 6:59 AM, Alletto, John M <john.m.alletto at lmco.com> wrote:
>
> Hi Barry,
>
> This make total sense for initialization - thank you.
> I am unfortunately still confused about what to do with ComputeRHS.
> In the unit compute matric I set the values of the stencil and the stencil placement in the working 3D array.
>
> I am working with an initial voltage problem and Laplace equation where Vnew equals a weight sum of its neighbors.
> Do I need to get the stencil and apply it, in compute RHS?
>
> Sorry if this is a dumb question, but I have spent a lot of time on this not sure of the correct step.
>
> Thanks
> John
> -----Original Message-----
> From: Barry Smith [mailto:bsmith at mcs.anl.gov]
> Sent: Friday, October 31, 2014 3:57 PM
> To: Alletto, John M
> Cc: petsc-dev
> Subject: EXTERNAL: Re: [petsc-dev] Sanity Check for were initial conditions are set in example ex45
>
>
> 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