<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I use ts_type arkimex, and I want at the end of every RK stage to apply a limiter function. How can I set TS so that to apply the function at the end of a RK stage?</blockquote>

<div><br></div><div>Jed added the new TSAdapt code (in petsc-dev), I would suggest looking at TS*SetAdapt. Here is the one for TSAlpha:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/TS/TSAlphaSetAdapt.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/TS/TSAlphaSetAdapt.html</a></div>

<div><br></div><div>If you looks in $PETSC_DIR/src/ts/examples/tutorials, ex17.c and ex18.c both fiddle with this. In theory, I believe it would be possible to add a custom arkimex adapter that would do this limiter (as a hack).</div>

<div><br></div><div>Before Matt or anyone else offers (and *depending on your problem!*) you could try to write this as a constrained inequality and use some of the new SNESVI capabilities:</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/SNES/SNESVISetVariableBounds.html">http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/SNES/SNESVISetVariableBounds.html</a></div>

</div>