<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Feb 13, 2017, at 3:08 PM, Ed Bueler <<a href="mailto:elbueler@alaska.edu" class="">elbueler@alaska.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">Barry --</div>
<div class=""><br class="">
</div>
> <span style="font-size:12.8px" class=""> Sounds like a bug to me. The methods should be checking if an</span>
<div class=""><span style="font-size:12.8px" class="">> IFunction is being provided and error out in that case.</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class="">I don't think it is that simple. I.e. having an IFunction and an explicit scheme is not, by itself, a bug. I think.</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class="">If the user has provided IFunction</span></div>
<div class=""><span style="font-size:12.8px" class=""> F(t,u,u_t) = u_t - f(t,u)</span></div>
<div class=""><span style="font-size:12.8px" class="">which is the convenient form for e.g. TSARKIMEX,</span></div>
<div class=""><span style="font-size:12.8px" class="">and RHSFunction</span></div>
<div class=""><span style="font-size:12.8px" class=""> G(t,u)</span></div>
<div class=""><span style="font-size:12.8px" class="">then I guess I assumed that explicit methods like TSRK should,for unconstrained cases, get their RHS by callback like this:</span></div>
<div class=""><span style="font-size:12.8px" class=""> g(t,u) = - F(t,u,0) + G(t,u)</span></div>
<div class=""><span style="font-size:12.8px" class="">so that the ODE is in form</span></div>
<div class=""><span style="font-size:12.8px" class=""> u_t = g(t,u) = f(t,u) + g(t,u)</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
</div>
</div>
</blockquote>
<div>
<div><br class="">
</div>
<div>PETSc does not transform IFunction to the RHS this way, and PETSc is not supposed to do it automatically. Note that IFunction may involve a mass matrix, e.g. <span style="font-size: 12.8px;" class="">F(t,u,u_t) = M*u_t - f(t,u) and sometimes M is not</span><span style="font-size: 12.8px;" class=""> </span><span style="font-size: 12.800000190734863px;" class="">invertible.</span></div>
<div class=""><span style="font-size: 12.800000190734863px;" class=""><br class="">
</span></div>
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><span style="font-size:12.8px" class="">I think that is the behavior I am seeing (i.e. on my problem, using PETSc master).</span></div>
</div>
</div>
</blockquote>
<div><span style="font-size: 12.800000190734863px;" class=""> </span></div>
<div>Explicit methods use only RHSFunction and ignore IFunction, so in your case, if you change TS type to rk and ssp at run time, you are actually solving u_t = G(t,u). If RHSFunction is not provided, PETSc will assume the RHS is zero (u_t=0). </div>
<div><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class="">The "nonsense" I am referring to is only from the non-enforcement of the constraint; it would be o.k. for a pure ODE.</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class="">I would love to have some projection mechanism to try, for comparing explicit methods with projection to the SNESVI way (i.e. the right way), but that is asking for a lot of PETSc refactoring, I think.
For now I just want to error-out if the method is not going to call the SNES at each time step.</span></div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>Check if TSGetSNES() returns NULL in your code?</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><span style="font-size:12.8px" class="">Ed</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
<div class=""><span style="font-size:12.8px" class=""><br class="">
</span></div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Mon, Feb 13, 2017 at 11:26 AM, Barry Smith <span dir="ltr" class="">
<<a href="mailto:bsmith@mcs.anl.gov" target="_blank" class="">bsmith@mcs.anl.gov</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br class="">
> On Feb 13, 2017, at 1:53 PM, Ed Bueler <<a href="mailto:elbueler@alaska.edu" class="">elbueler@alaska.edu</a>> wrote:<br class="">
><br class="">
> Dear Petsc --<br class="">
><br class="">
> This is the first of two short TS usage questions.<br class="">
><br class="">
> My problem is both stiff (diffusive PDE) and constrained, so I require<br class="">
><br class="">
> -snes_type vinewton{rs|ss}ls<br class="">
><br class="">
> *and* I split my ODE system into IFunction and RHSFunction<br class="">
><br class="">
> F(t,u,u_t) = G(t,u)<br class="">
><br class="">
> where F(t,u,u_t) = u_t + f(t,u) in my case (i.e. no mass matrix needed), and the stiff part goes in f(t,u).<br class="">
><br class="">
> With this arrangement TS types beuler, theta, bdf, arkimex all work quite well. However, the program runs and produces nonsense with type rk and ssp, that is, explicit methods.<br class="">
<br class="">
</span> Sounds like a bug to me. The methods should be checking if an IFunction is being provided and error out in that case.<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
Barry<br class="">
</font></span>
<div class="HOEnZb">
<div class="h5"><br class="">
><br class="">
> So my question is, how do I ask the TS (at run time) whether the chosen TS type will or will not call its SNES at each step? If SNES is not going to be used then I want to SETERRQ and stop. That is, I want to error-out if the *method* is fully explicit.<br class="">
><br class="">
> Note the constraints are enforced by the SNESVI, as they should be, not ad hoc projection. Also, as a technical matter, I cannot require my iterates to be feasible inside my IFunction evaluation because that would break VINEWTONSSLS.<br class="">
><br class="">
> Neither TSProblemType (mine is NONLINEAR) nor TSEquationType (mine is IMPLICIT I guess) seem to address this? My problem is indeed nonlinear and has stiff parts, but it is not a DAE and it *is* constrained.<br class="">
><br class="">
> Thanks!<br class="">
><br class="">
> Ed<br class="">
><br class="">
> PS I'd prefer not to enumerate the existing TS types and error on the bad ones. It is not nicely-maintainable.<br class="">
><br class="">
><br class="">
><br class="">
> --<br class="">
> Ed Bueler<br class="">
> Dept of Math and Stat and Geophysical Institute<br class="">
> University of Alaska Fairbanks<br class="">
> Fairbanks, AK 99775-6660<br class="">
> 301C Chapman and 410D Elvey<br class="">
> <a href="tel:907%20474-7693" value="+19074747693" class="">907 474-7693</a> and
<a href="tel:907%20474-7199" value="+19074747199" class="">907 474-7199</a> (fax
<a href="tel:907%20474-5394" value="+19074745394" class="">907 474-5394</a>)<br class="">
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div class="gmail_signature" data-smartmail="gmail_signature">Ed Bueler<br class="">
Dept of Math and Stat and Geophysical Institute<br class="">
University of Alaska Fairbanks<br class="">
Fairbanks, AK 99775-6660<br class="">
301C Chapman and 410D Elvey<br class="">
907 474-7693 and 907 474-7199 (fax 907 474-5394)</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>