<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 13, 2017 at 3:59 PM, Zhang, Hong <span dir="ltr"><<a href="mailto:hongzhang@anl.gov" target="_blank">hongzhang@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<br>
<div><span class="">
<blockquote type="cite">
<div>On Feb 13, 2017, at 3:08 PM, Ed Bueler <<a href="mailto:elbueler@alaska.edu" target="_blank">elbueler@alaska.edu</a>> wrote:</div>
<br class="m_-5011874010041653505Apple-interchange-newline">
<div>
<div dir="ltr">
<div>Barry --</div>
<div><br>
</div>
> <span style="font-size:12.8px"> Sounds like a bug to me. The methods should be checking if an</span>
<div><span style="font-size:12.8px">> IFunction is being provided and error out in that case.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">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><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">If the user has provided IFunction</span></div>
<div><span style="font-size:12.8px"> F(t,u,u_t) = u_t - f(t,u)</span></div>
<div><span style="font-size:12.8px">which is the convenient form for e.g. TSARKIMEX,</span></div>
<div><span style="font-size:12.8px">and RHSFunction</span></div>
<div><span style="font-size:12.8px"> G(t,u)</span></div>
<div><span style="font-size:12.8px">then I guess I assumed that explicit methods like TSRK should,for unconstrained cases, get their RHS by callback like this:</span></div>
<div><span style="font-size:12.8px"> g(t,u) = - F(t,u,0) + G(t,u)</span></div>
<div><span style="font-size:12.8px">so that the ODE is in form</span></div>
<div><span style="font-size:12.8px"> u_t = g(t,u) = f(t,u) + g(t,u)</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
</div>
</div>
</blockquote>
</span><div>
<div><br>
</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">F(t,u,u_t) = M*u_t - f(t,u) and sometimes M is not</span><span style="font-size:12.8px"> </span><span style="font-size:12.800000190734863px">invertible.</span></div>
<div><span style="font-size:12.800000190734863px"><br>
</span></div>
</div><span class="">
<br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div><span style="font-size:12.8px">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"> </span></div>
</span><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></div></blockquote><div><br></div><div>I do not agree with this. I thought our aim was to support users comparing explicit with implicit with semi-implicit. This breaks that model completely.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class="">
<blockquote type="cite">
<div>
<div dir="ltr">
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">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><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">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>
</div>
</span><div>Check if TSGetSNES() returns NULL in your code?</div><div><div class="h5">
<br>
<blockquote type="cite">
<div>
<div dir="ltr">
<div><span style="font-size:12.8px">Ed</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Feb 13, 2017 at 11:26 AM, Barry Smith <span dir="ltr">
<<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
> On Feb 13, 2017, at 1:53 PM, Ed Bueler <<a href="mailto:elbueler@alaska.edu" target="_blank">elbueler@alaska.edu</a>> wrote:<br>
><br>
> Dear Petsc --<br>
><br>
> This is the first of two short TS usage questions.<br>
><br>
> My problem is both stiff (diffusive PDE) and constrained, so I require<br>
><br>
> -snes_type vinewton{rs|ss}ls<br>
><br>
> *and* I split my ODE system into IFunction and RHSFunction<br>
><br>
> F(t,u,u_t) = G(t,u)<br>
><br>
> 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>
><br>
> 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>
<br>
</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>
<span class="m_-5011874010041653505HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span>
<div class="m_-5011874010041653505HOEnZb">
<div class="m_-5011874010041653505h5"><br>
><br>
> 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>
><br>
> 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>
><br>
> 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>
><br>
> Thanks!<br>
><br>
> Ed<br>
><br>
> PS I'd prefer not to enumerate the existing TS types and error on the bad ones. It is not nicely-maintainable.<br>
><br>
><br>
><br>
> --<br>
> Ed Bueler<br>
> Dept of Math and Stat and Geophysical Institute<br>
> University of Alaska Fairbanks<br>
> Fairbanks, AK 99775-6660<br>
> 301C Chapman and 410D Elvey<br>
> <a href="tel:907%20474-7693" value="+19074747693" target="_blank">907 474-7693</a> and
<a href="tel:907%20474-7199" value="+19074747199" target="_blank">907 474-7199</a> (fax
<a href="tel:907%20474-5394" value="+19074745394" target="_blank">907 474-5394</a>)<br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="m_-5011874010041653505gmail_signature" data-smartmail="gmail_signature">Ed Bueler<br>
Dept of Math and Stat and Geophysical Institute<br>
University of Alaska Fairbanks<br>
Fairbanks, AK 99775-6660<br>
301C Chapman and 410D Elvey<br>
<a href="tel:(907)%20474-7693" value="+19074747693" target="_blank">907 474-7693</a> and <a href="tel:(907)%20474-7199" value="+19074747199" target="_blank">907 474-7199</a> (fax <a href="tel:(907)%20474-5394" value="+19074745394" target="_blank">907 474-5394</a>)</div>
</div>
</div>
</blockquote>
</div></div></div>
<br>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>