[petsc-users] DMMG with PBC

khalid ashraf khalid_eee at yahoo.com
Tue Apr 19 01:34:13 CDT 2011


Hi Matt,
I wrote the following line after DMMGSetKSP() in ex22.c 
ierr =DMMGSetNullSpace(dmmg,PETSC_TRUE,0,PETSC_NULL);


Still I get the difference in the values calculated by single processor and the 
multiple processors.
The two input values for b that I used are 1 and 10 for all the elements in the 
vector. I am using this
code in one of my programs where I assign a random number to b. I get the 
discrepancy between 
single and multiple processors there as well.  

Thanks.

Khalid



________________________________
From: Matthew Knepley <knepley at gmail.com>
To: PETSc users list <petsc-users at mcs.anl.gov>
Cc: khalid ashraf <khalid_eee at yahoo.com>
Sent: Fri, April 15, 2011 4:38:25 AM
Subject: Re: [petsc-users] DMMG with PBC

On Fri, Apr 15, 2011 at 4:28 AM, khalid ashraf <khalid_eee at yahoo.com> wrote:

Hi,
>I am running src/ksp/ksp/examples/tutorials/ex22.c
>I matched the output of single processor and multiprocessor results and it works 
>fine.
>But I want to use a periodic boundary condition. I make the following changes in 
>the main function and this works fine with this change as well:
>
>
>  ierr = DMMGCreate(PETSC_COMM_WORLD,1,PETSC_NULL,&dmmg);CHKERRQ(ierr);
>  ierr = 
>DACreate3d(PETSC_COMM_WORLD,DA_XYZPERIODIC,DA_STENCIL_STAR,10,10,2,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr);
>
>
>
>
>
>However, when I comment out these following lines since I am using a PBC, then 
>the result of 1 proc and multi-proc are not the same. They vary within 5 decimal 
>points and  the difference increases with increasing number of processors. 

The periodic operator has a null space. You must put that in the solver 
DMMGSetNullSpace(), so that it is projected out at each step.

   Matt
 
/*      if (i==0 || j==0 || k==0 || i==mx-1 || j==my-1 || k==mz-1){
>          v[0] = 2.0*(HxHydHz + HxHzdHy + HyHzdHx);
>          ierr = 
>MatSetValuesStencil(B,1,&row,1,&row,v,INSERT_VALUES);CHKERRQ(ierr);
>        } else */
>
>
>Could you please tell me what is going wrong here.
>
>
>Thanks.


-- 
What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110418/046ca4fd/attachment.htm>


More information about the petsc-users mailing list