[petsc-users] want some explanations on BC setup

Li, Zhisong (lizs) lizs at mail.uc.edu
Thu Apr 22 19:59:49 CDT 2010


 Hi,

My objective is to write a primitive variable CFD solver based on SNES and TS. As a new user, I plan to start with the tutorial code snes/ex19.c by removing the temperature term. Then I can implement its equations and boundary conditions (BC) into the tutorial code ts/ex7.c for pseudo-transient. Finally I can switch to primitive variables.

But I could not fully understand the BC setup in the tutorial codes and could not get a correct result by simply imitating the tutorial codes or my own attempts.

PETSc usually defines F as the function vector and X as solution vector. In snes/ex19.c, the BC are setup by manipulating arrays pointing to F and X, such as:

f[j][i].u = x[j][i].u - lid;       (line 297)

in which x[j][i].u is initialized as zero by other function. Why it's here " - lid" rather than "+ lid"? How about if we use " f[j][i].u = - lid " or " x[j][i].u = - lid "? And in my test runs with a modified ts/ex7.c with equations and BC from snes/ex19.c , only BC with " x[j][i] = some numerical value " can give a convergent result.


I also found that in TS codes an initial condition at the boundary will overwrite the BC setup if they are of different values. Is this a bug?

I think TS is something like a structure, but I cannot find descriptions of its members like "step","ptime" and "v" in any document. To run a TS simulation successfully, does it require a NORM_2 of "v" converge?


Thank you very much.



Best regards,

Zhisong Li












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


More information about the petsc-users mailing list