As I want to keep my code structure as before applying SNES, I defined a FieldContext and pass my data like element and face values into this context by pointing there addresses of elements and faces of the field like this:
typedef struct { element* e; face* f; flow* flw; }FieldCtx; and then: FC.e = e; FC.f = f; FC.flw = flw; and pass FieldContext into SNESSetFunction and SNESSetJacobian. Here I checked that all my routine work as before except one (related to convective flux) which I really do not know why the values just for this routine is not match as before. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111123/b312f980/attachment.htm>