<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> Pushed<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 27, 2020, at 3:41 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Tue, Oct 27, 2020 at 4:24 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><br class=""><div class=""> I'm sorry the code is still fundamentally broken, I know I promised a long time ago to fix it all up but it is actually pretty hard to get right.</div><div class=""><br class=""></div><div class=""> It detects the zero by finding a small value when it should detect it by find a small region where it changes sign but surprising it is so hardwired</div><div class="">to the size test that fixing it and testing the new code has been very difficult to me. My branch is <span style="font-family:Menlo;font-size:16px" class="">barry/2019-08-18/fix-tsevent-posteventdt</span></div></div></blockquote><div class=""><br class=""></div><div class="">Barry, I do not see this branch on gitlab. Can you give a URL?</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class=""><span style="font-family:Menlo;font-size:16px" class=""> Barry</span></div><div class=""><span style="font-family:Menlo;font-size:16px" class=""><br class=""></span></div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Oct 27, 2020, at 3:02 PM, Blondel, Sophie via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a>> wrote:</div><br class=""><div class="">
<div dir="ltr" class="">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
Hi Matt,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
With the ex40 I attached in my previous email here is what I get printed on screen when running "./ex40 -ts_monitor -ts_event_monitor":</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
0 TS dt 0.1 time 0.
<div class="">1 TS dt 0.5 time 0.1</div>
<div class="">2 TS dt 0.5 time 0.6</div>
<div class="">3 TS dt 0.5 time 1.1</div>
<div class="">4 TS dt 0.5 time 1.6</div>
<div class="">5 TS dt 0.5 time 2.1</div>
<div class="">6 TS dt 0.5 time 2.6</div>
<div class="">7 TS dt 0.5 time 3.1</div>
<div class="">8 TS dt 0.5 time 3.6</div>
<div class="">9 TS dt 0.5 time 4.1</div>
<div class="">10 TS dt 0.5 time 4.6</div>
<div class="">11 TS dt 0.5 time 5.1</div>
<div class="">12 TS dt 0.5 time 5.6</div>
<div class="">13 TS dt 0.5 time 6.1</div>
<div class="">14 TS dt 0.5 time 6.6</div>
<div class="">15 TS dt 0.5 time 7.1</div>
<div class="">TSEvent: Event 0 zero crossing at time 7.6 located in 0 iterations</div>
<div class="">Ball hit the ground at t = 7.60 seconds</div>
<div class="">16 TS dt 0.5 time 7.6</div>
<div class="">17 TS dt 0.5 time 8.1</div>
<div class="">18 TS dt 0.5 time 8.6</div>
<div class="">19 TS dt 0.5 time 9.1</div>
<div class="">20 TS dt 0.5 time 9.6</div>
<div class="">21 TS dt 0.5 time 10.1</div>
<div class="">22 TS dt 0.5 time 10.6</div>
<div class="">23 TS dt 0.5 time 11.1</div>
<div class="">24 TS dt 0.5 time 11.6</div>
<div class="">25 TS dt 0.5 time 12.1</div>
<div class="">26 TS dt 0.5 time 12.6</div>
<div class="">27 TS dt 0.5 time 13.1</div>
<div class="">28 TS dt 0.5 time 13.6</div>
<div class="">29 TS dt 0.5 time 14.1</div>
<div class="">30 TS dt 0.5 time 14.6</div>
<div class="">31 TS dt 0.5 time 15.1</div>
<div class="">32 TS dt 0.5 time 15.6</div>
<div class="">33 TS dt 0.5 time 16.1</div>
<div class="">34 TS dt 0.5 time 16.6</div>
<div class="">35 TS dt 0.5 time 17.1</div>
<div class="">36 TS dt 0.5 time 17.6</div>
<div class="">37 TS dt 0.5 time 18.1</div>
<div class="">38 TS dt 0.5 time 18.6</div>
<div class="">39 TS dt 0.5 time 19.1</div>
<div class="">40 TS dt 0.5 time 19.6</div>
<div class="">41 TS dt 0.5 time 20.1</div>
<div class="">42 TS dt 0.5 time 20.6</div>
<div class="">43 TS dt 0.5 time 21.1</div>
<div class="">44 TS dt 0.5 time 21.6</div>
<div class="">45 TS dt 0.5 time 22.1</div>
<div class="">46 TS dt 0.5 time 22.6</div>
<div class="">47 TS dt 0.5 time 23.1</div>
<div class="">48 TS dt 0.5 time 23.6</div>
<div class="">49 TS dt 0.5 time 24.1</div>
<div class="">50 TS dt 0.5 time 24.6</div>
<div class="">51 TS dt 0.5 time 25.1</div>
<div class="">TSEvent: Event 0 zero crossing at time 25.6 located in 0 iterations</div>
<div class="">Ball hit the ground at t = 25.60 seconds</div>
<div class="">52 TS dt 0.5 time 25.6</div>
<div class="">53 TS dt 0.5 time 26.1</div>
<div class="">54 TS dt 0.5 time 26.6</div>
<div class="">55 TS dt 0.5 time 27.1</div>
<div class="">56 TS dt 0.5 time 27.6</div>
<div class="">57 TS dt 0.5 time 28.1</div>
<div class="">58 TS dt 0.5 time 28.6</div>
<div class="">59 TS dt 0.5 time 29.1</div>
<div class="">60 TS dt 0.5 time 29.6</div>
<div class="">61 TS dt 0.5 time 30.1</div>
<div class="">0 TS dt 0.1 time 0.</div>
<div class="">1 TS dt 0.5 time 0.1</div>
<div class="">2 TS dt 0.5 time 0.6</div>
<div class="">3 TS dt 0.5 time 1.1</div>
<div class="">4 TS dt 0.5 time 1.6</div>
<div class="">5 TS dt 0.5 time 2.1</div>
<div class="">6 TS dt 0.5 time 2.6</div>
<div class="">7 TS dt 0.5 time 3.1</div>
<div class="">8 TS dt 0.5 time 3.6</div>
<div class="">9 TS dt 0.5 time 4.1</div>
<div class="">10 TS dt 0.5 time 4.6</div>
<div class="">11 TS dt 0.5 time 5.1</div>
<div class="">12 TS dt 0.5 time 5.6</div>
<div class="">13 TS dt 0.5 time 6.1</div>
<div class="">14 TS dt 0.5 time 6.6</div>
<div class="">15 TS dt 0.5 time 7.1</div>
<div class="">16 TS dt 0.5 time 7.6</div>
<div class="">17 TS dt 0.5 time 8.1</div>
<div class="">18 TS dt 0.5 time 8.6</div>
<div class="">19 TS dt 0.5 time 9.1</div>
<div class="">20 TS dt 0.5 time 9.6</div>
<div class="">21 TS dt 0.5 time 10.1</div>
<div class="">22 TS dt 0.5 time 10.6</div>
<div class="">23 TS dt 0.5 time 11.1</div>
<div class="">24 TS dt 0.5 time 11.6</div>
<div class="">25 TS dt 0.5 time 12.1</div>
<div class="">26 TS dt 0.5 time 12.6</div>
<div class="">TSEvent: Event 0 zero crossing at time 13.1 located in 0 iterations</div>
<div class="">Ball hit the ground at t = 13.10 seconds</div>
<div class="">27 TS dt 0.5 time 13.1</div>
<div class="">28 TS dt 0.5 time 13.6</div>
<div class="">29 TS dt 0.5 time 14.1</div>
<div class="">30 TS dt 0.5 time 14.6</div>
<div class="">31 TS dt 0.5 time 15.1</div>
<div class="">32 TS dt 0.5 time 15.6</div>
<div class="">33 TS dt 0.5 time 16.1</div>
<div class="">34 TS dt 0.5 time 16.6</div>
<div class="">35 TS dt 0.5 time 17.1</div>
<div class="">36 TS dt 0.5 time 17.6</div>
<div class="">37 TS dt 0.5 time 18.1</div>
<div class="">38 TS dt 0.5 time 18.6</div>
<div class="">39 TS dt 0.5 time 19.1</div>
<div class="">40 TS dt 0.5 time 19.6</div>
<div class="">41 TS dt 0.5 time 20.1</div>
<div class="">42 TS dt 0.5 time 20.6</div>
<div class="">43 TS dt 0.5 time 21.1</div>
<div class="">44 TS dt 0.5 time 21.6</div>
<div class="">45 TS dt 0.5 time 22.1</div>
<div class="">46 TS dt 0.5 time 22.6</div>
<div class="">47 TS dt 0.5 time 23.1</div>
<div class="">TSEvent: Event 0 zero crossing at time 23.6 located in 0 iterations</div>
<div class="">Ball hit the ground at t = 23.60 seconds</div>
<div class="">48 TS dt 0.5 time 23.6</div>
<div class="">49 TS dt 0.5 time 24.1</div>
<div class="">50 TS dt 0.5 time 24.6</div>
<div class="">51 TS dt 0.5 time 25.1</div>
<div class="">52 TS dt 0.5 time 25.6</div>
<div class="">53 TS dt 0.5 time 26.1</div>
<div class="">TSEvent: Event 0 zero crossing at time 26.6 located in 0 iterations</div>
<div class="">Ball hit the ground at t = 26.60 seconds</div>
<div class="">54 TS dt 0.5 time 26.6</div>
<div class="">55 TS dt 0.5 time 27.1</div>
<div class="">56 TS dt 0.5 time 27.6</div>
<div class="">57 TS dt 0.5 time 28.1</div>
<div class="">58 TS dt 0.5 time 28.6</div>
<div class="">59 TS dt 0.5 time 29.1</div>
<div class="">60 TS dt 0.5 time 29.6</div>
61 TS dt 0. time 30.1<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
I don't see the 0.001 timestep here, do you get a different behavior?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
Thank you,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
Sophie<br class="">
</div>
<div id="gmail-m_1734284790163750498appendonsend" class=""></div>
<hr style="display:inline-block;width:98%" class="">
<div id="gmail-m_1734284790163750498divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size:11pt" class=""><b class="">From:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>><br class="">
<b class="">Sent:</b> Tuesday, October 27, 2020 15:34<br class="">
<b class="">To:</b> Blondel, Sophie <<a href="mailto:sblondel@utk.edu" target="_blank" class="">sblondel@utk.edu</a>><br class="">
<b class="">Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a>>; <a href="mailto:xolotl-psi-development@lists.sourceforge.net" target="_blank" class="">xolotl-psi-development@lists.sourceforge.net</a> <<a href="mailto:xolotl-psi-development@lists.sourceforge.net" target="_blank" class="">xolotl-psi-development@lists.sourceforge.net</a>><br class="">
<b class="">Subject:</b> Re: [petsc-users] TSSetEventHandler and TSSetPostEventIntervalStep</font>
<div class=""> </div>
</div>
<div class=""><p class=""><span style="color:rgb(51,51,51);background-color:rgb(252,235,166);border:10px solid rgb(252,235,166);font-family:Arial,sans-serif;margin-top:12px" class=""><strong class="">[External Email]</strong></span></p>
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">On Tue, Oct 27, 2020 at 3:09 PM Blondel, Sophie via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a>> wrote:<br class="">
</div>
<div class="">
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="">
<div dir="ltr" class="">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
I am currently using TSSetEventHandler in my code to detect a random event where the solution vector gets modified during the event. Ideally, after the event happens I want the solver to use a much smaller timestep using TSSetPostEventIntervalStep. However,
when I use TSSetPostEventIntervalStep the solver doesn't use the set value. I managed to reproduce the behavior by modifying ex40.c as attached.</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class=""> I stepped through ex40, and it does indeed change the timestep to 0.001. Can you be more specific, perhaps with monitors, about what you think is wrong?</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<div class=""> </div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="">
<div dir="ltr" class="">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
I think the issue is related to the fact that the fvalue is not technically "approaching" 0 with a random event, it is more of a step function instead. Do you have any recommendation on how to implement the behavior I'm looking for? Let me know if I can provide
additional information.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
Best,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
<br class="">
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt" class="">
Sophie<br class="">
</div>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div><br class=""></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></body></html>