ksp ex29.c B.C.s and Forcing terms.
Ryan Yan
vyan2000 at gmail.com
Sat Dec 12 16:34:01 CST 2009
Hi Barry,
Since the ex32.c has been brought up to make comparison with ex29.c. Can I
just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the
case where one has cell centered unknown for the u, with vertex centered f.
Feel free to criticize this comment please, and this is where I get very
confused.
Thanks,
Yan
On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote:
>
> Hello,
>>
>> SOrry. I took this very interesting discussion a bit late, but one of my
>> major problem is to understand if all this is valid for node centered
>> variables for u or cell centered.
>> Usually the best way of solving Neuwman BC for this equation is having
>> cell centered unknowns to have derivatives
>> given on the domain boundary.
>> This then have some impact on handling ghost values transfer between
>> subdomains with MPI.Is all this transparent for
>> us and PETSC handle it . I guess no, right ?
>>
>
> If you have only cell centered unknowns the ghost point updates are the
> same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some
> Dirichlet boundary conditions is then trickery with cell centered.
>
> If you have some cell-centered and some vertex centered unknowns
> (staggered grid), DA does not handle this well, you have to "cheat" to match
> up variables on the cells and vertices.
>
>
> Barry
>
>
>
>> Tahar
>>
>>
>> Le 12 déc. 09 à 02:28, Barry Smith a écrit :
>>
>>
>>> 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
>>>>
>>>>
>> --------------------------------------------
>> T. Amari
>> Centre de Physique Theorique
>> Ecole Polytechnique
>> 91128 Palaiseau Cedex France
>> tel : 33 1 69 33 42 52
>> fax: 33 1 69 33 49 49
>> email: <mailto:amari at cpht.polytechnique.fr>
>> URL : http://www.cpht.polytechnique.fr/cpht/amari
>>
>>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20091212/8d2d5336/attachment.htm>
More information about the petsc-users
mailing list