ksp ex29.c B.C.s and Forcing terms.

Barry Smith bsmith at mcs.anl.gov
Fri Dec 11 19:28:02 CST 2009


On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote:

> Hi Matt,
> Thank you very much for the reply.  Now, I got the Neumann part. But  
> I am still a bit confused about the Dirichlet part. Please see the  
> following quote.
>
> Yan
>
>
> For the Dirichlet B.C.s, I did not understand the coefficients given  
> below. Isn't correct to set the v[0]=Hx*Hy here?
> if (i==0 || j==0 || i==mx-1 || j==my-1) {
> if (user->bcType == DIRICHLET) {
>   v[0] = 2.0*rho*(HxdHy + HydHx);
>   }
> }
>
> This is the proper scaling.
>
> the Dirichlet B.C.s:
> Which  scaling  do you think is proper, "v[0]=Hx*Hy" or  
> 2.0*rho*(HxdHy + HydHx)?
> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more  
> about why is this one? I only see a factor of Hx*Hy when we set up  
> the  RHS. Did I miss something?
>
    Ryan,

      You can scale the equations for Dirichlet boundary conditions  
anyway you want; you could multiply them by 1,000,000 if you want. The  
answer in exact precision with direct solvers will be the same. The  
reason we use the given scaling is to make the scaling work well with  
multigrid. If you use a different scaling the Dirichlet boundary  
conditions on the coarser grid matrices would have a different scaling  
then the interior equations and this would slow down MG's convergence  
rate. For toy problems people usually eliminate the Dirichlet boundary  
conditions, then there is no scaling issue for multigrid.


    Barry

>
>   Matt
>
>
>
>
>
> -- 
> 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
>



More information about the petsc-users mailing list