I’ve begun working on implementing a projected time stepping method for solving y’ = f(y), where g(y(t)) is an invariant of the flow. Per a previous email exchange, it was suggested that I use TSSetPostStep to perform the projection routine, calling TSGetSolution obtain the current iterate, which will be corrected with the projection. However, I noticed two things:
1. The documentation for TSGetSolution says "This vector not changed until the solution at the next timestep has been calculated.” Does that mean that if I make a change to the solution in a PostStep function, it won’t be captured until the next step? What happens at the final time step? 2. The projection is nonlinear, requiring the use of a SNES. I had originally thought that I would create/configure/destroy the SNES within the main routine of the code, and pass this to the PostStep through a user data structure. However, the TSSetPostStep function seems to only take functions which are exclusively functions of the TS. Likewise, I would need to create a residual vector, r, for the SNESSetFunction. Is there a way to pass these data structures, so that they can be reused. or would they have to be created/destroyed within the PostStep function at each iterate? How costly would that be? -gideon