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

Ryan Yan vyan2000 at gmail.com
Fri Dec 11 15:40:38 CST 2009


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?


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);
  }
}

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

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

Yan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20091211/a097a61a/attachment.htm>


More information about the petsc-users mailing list