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

Matthew Knepley knepley at gmail.com
Fri Dec 11 17:13:49 CST 2009


On Fri, Dec 11, 2009 at 3:40 PM, Ryan Yan <vyan2000 at gmail.com> wrote:

> Hi All,
> I am tring to understand the example in ksp tutorials ex29.c
>
> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/ksp/ksp/examples/tutorials/ex29.c.html
>
> For the forcing terms of codes,
>
> array[j][i] =
> PetscExpScalar(-((PetscReal)i*Hx)*((PetscReal)i*Hx)/user->nu)*PetscExpScalar(-((PetscReal)j*Hy)*((PetscReal)j*Hy)/user->nu)*Hx*Hy;
>
> if ignoring the scaling, then it is actually calculating a forcing
> function:
>
> f = e^{-( x)^2/\nu} e^{-( y)^2/\nu}, which is different with the one given
> in the comments of the code. Or did I miss somthing here?
>

Yes, it appears the comment is in error.


> For the Dirichlet B.C.s, I did not understand the coefficients **<http://www.physicsforums.com/showthread.php?t=51412>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.


> Also, for Nueman B.C.s, are we solving for du/dx+du/dy=0?
>

Homogeneous Neumann conditions would be \hat n \cdot \nabla u = 0.

  Matt


> Sorry for so many detail questions, and thank you very much for any
> suggestions.
>
> Yan
>



-- 
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/20091211/b16f60b3/attachment.htm>


More information about the petsc-users mailing list