<div dir="ltr"><div dir="ltr">On Tue, Oct 27, 2020 at 4:24 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></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;"><br><div> 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><br></div><div> 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>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">barry/2019-08-18/fix-tsevent-posteventdt</span></div></div></blockquote><div><br></div><div>Barry, I do not see this branch on gitlab. Can you give a URL?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </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;"><div><span style="font-family:Menlo;font-size:16px"> Barry</span></div><div><span style="font-family:Menlo;font-size:16px"><br></span></div><div><br></div><div><br><blockquote type="cite"><div>On Oct 27, 2020, at 3:02 PM, Blondel, Sophie via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:</div><br><div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Hi Matt,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
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">
0 TS dt 0.1 time 0.
<div>1 TS dt 0.5 time 0.1</div>
<div>2 TS dt 0.5 time 0.6</div>
<div>3 TS dt 0.5 time 1.1</div>
<div>4 TS dt 0.5 time 1.6</div>
<div>5 TS dt 0.5 time 2.1</div>
<div>6 TS dt 0.5 time 2.6</div>
<div>7 TS dt 0.5 time 3.1</div>
<div>8 TS dt 0.5 time 3.6</div>
<div>9 TS dt 0.5 time 4.1</div>
<div>10 TS dt 0.5 time 4.6</div>
<div>11 TS dt 0.5 time 5.1</div>
<div>12 TS dt 0.5 time 5.6</div>
<div>13 TS dt 0.5 time 6.1</div>
<div>14 TS dt 0.5 time 6.6</div>
<div>15 TS dt 0.5 time 7.1</div>
<div>TSEvent: Event 0 zero crossing at time 7.6 located in 0 iterations</div>
<div>Ball hit the ground at t = 7.60 seconds</div>
<div>16 TS dt 0.5 time 7.6</div>
<div>17 TS dt 0.5 time 8.1</div>
<div>18 TS dt 0.5 time 8.6</div>
<div>19 TS dt 0.5 time 9.1</div>
<div>20 TS dt 0.5 time 9.6</div>
<div>21 TS dt 0.5 time 10.1</div>
<div>22 TS dt 0.5 time 10.6</div>
<div>23 TS dt 0.5 time 11.1</div>
<div>24 TS dt 0.5 time 11.6</div>
<div>25 TS dt 0.5 time 12.1</div>
<div>26 TS dt 0.5 time 12.6</div>
<div>27 TS dt 0.5 time 13.1</div>
<div>28 TS dt 0.5 time 13.6</div>
<div>29 TS dt 0.5 time 14.1</div>
<div>30 TS dt 0.5 time 14.6</div>
<div>31 TS dt 0.5 time 15.1</div>
<div>32 TS dt 0.5 time 15.6</div>
<div>33 TS dt 0.5 time 16.1</div>
<div>34 TS dt 0.5 time 16.6</div>
<div>35 TS dt 0.5 time 17.1</div>
<div>36 TS dt 0.5 time 17.6</div>
<div>37 TS dt 0.5 time 18.1</div>
<div>38 TS dt 0.5 time 18.6</div>
<div>39 TS dt 0.5 time 19.1</div>
<div>40 TS dt 0.5 time 19.6</div>
<div>41 TS dt 0.5 time 20.1</div>
<div>42 TS dt 0.5 time 20.6</div>
<div>43 TS dt 0.5 time 21.1</div>
<div>44 TS dt 0.5 time 21.6</div>
<div>45 TS dt 0.5 time 22.1</div>
<div>46 TS dt 0.5 time 22.6</div>
<div>47 TS dt 0.5 time 23.1</div>
<div>48 TS dt 0.5 time 23.6</div>
<div>49 TS dt 0.5 time 24.1</div>
<div>50 TS dt 0.5 time 24.6</div>
<div>51 TS dt 0.5 time 25.1</div>
<div>TSEvent: Event 0 zero crossing at time 25.6 located in 0 iterations</div>
<div>Ball hit the ground at t = 25.60 seconds</div>
<div>52 TS dt 0.5 time 25.6</div>
<div>53 TS dt 0.5 time 26.1</div>
<div>54 TS dt 0.5 time 26.6</div>
<div>55 TS dt 0.5 time 27.1</div>
<div>56 TS dt 0.5 time 27.6</div>
<div>57 TS dt 0.5 time 28.1</div>
<div>58 TS dt 0.5 time 28.6</div>
<div>59 TS dt 0.5 time 29.1</div>
<div>60 TS dt 0.5 time 29.6</div>
<div>61 TS dt 0.5 time 30.1</div>
<div>0 TS dt 0.1 time 0.</div>
<div>1 TS dt 0.5 time 0.1</div>
<div>2 TS dt 0.5 time 0.6</div>
<div>3 TS dt 0.5 time 1.1</div>
<div>4 TS dt 0.5 time 1.6</div>
<div>5 TS dt 0.5 time 2.1</div>
<div>6 TS dt 0.5 time 2.6</div>
<div>7 TS dt 0.5 time 3.1</div>
<div>8 TS dt 0.5 time 3.6</div>
<div>9 TS dt 0.5 time 4.1</div>
<div>10 TS dt 0.5 time 4.6</div>
<div>11 TS dt 0.5 time 5.1</div>
<div>12 TS dt 0.5 time 5.6</div>
<div>13 TS dt 0.5 time 6.1</div>
<div>14 TS dt 0.5 time 6.6</div>
<div>15 TS dt 0.5 time 7.1</div>
<div>16 TS dt 0.5 time 7.6</div>
<div>17 TS dt 0.5 time 8.1</div>
<div>18 TS dt 0.5 time 8.6</div>
<div>19 TS dt 0.5 time 9.1</div>
<div>20 TS dt 0.5 time 9.6</div>
<div>21 TS dt 0.5 time 10.1</div>
<div>22 TS dt 0.5 time 10.6</div>
<div>23 TS dt 0.5 time 11.1</div>
<div>24 TS dt 0.5 time 11.6</div>
<div>25 TS dt 0.5 time 12.1</div>
<div>26 TS dt 0.5 time 12.6</div>
<div>TSEvent: Event 0 zero crossing at time 13.1 located in 0 iterations</div>
<div>Ball hit the ground at t = 13.10 seconds</div>
<div>27 TS dt 0.5 time 13.1</div>
<div>28 TS dt 0.5 time 13.6</div>
<div>29 TS dt 0.5 time 14.1</div>
<div>30 TS dt 0.5 time 14.6</div>
<div>31 TS dt 0.5 time 15.1</div>
<div>32 TS dt 0.5 time 15.6</div>
<div>33 TS dt 0.5 time 16.1</div>
<div>34 TS dt 0.5 time 16.6</div>
<div>35 TS dt 0.5 time 17.1</div>
<div>36 TS dt 0.5 time 17.6</div>
<div>37 TS dt 0.5 time 18.1</div>
<div>38 TS dt 0.5 time 18.6</div>
<div>39 TS dt 0.5 time 19.1</div>
<div>40 TS dt 0.5 time 19.6</div>
<div>41 TS dt 0.5 time 20.1</div>
<div>42 TS dt 0.5 time 20.6</div>
<div>43 TS dt 0.5 time 21.1</div>
<div>44 TS dt 0.5 time 21.6</div>
<div>45 TS dt 0.5 time 22.1</div>
<div>46 TS dt 0.5 time 22.6</div>
<div>47 TS dt 0.5 time 23.1</div>
<div>TSEvent: Event 0 zero crossing at time 23.6 located in 0 iterations</div>
<div>Ball hit the ground at t = 23.60 seconds</div>
<div>48 TS dt 0.5 time 23.6</div>
<div>49 TS dt 0.5 time 24.1</div>
<div>50 TS dt 0.5 time 24.6</div>
<div>51 TS dt 0.5 time 25.1</div>
<div>52 TS dt 0.5 time 25.6</div>
<div>53 TS dt 0.5 time 26.1</div>
<div>TSEvent: Event 0 zero crossing at time 26.6 located in 0 iterations</div>
<div>Ball hit the ground at t = 26.60 seconds</div>
<div>54 TS dt 0.5 time 26.6</div>
<div>55 TS dt 0.5 time 27.1</div>
<div>56 TS dt 0.5 time 27.6</div>
<div>57 TS dt 0.5 time 28.1</div>
<div>58 TS dt 0.5 time 28.6</div>
<div>59 TS dt 0.5 time 29.1</div>
<div>60 TS dt 0.5 time 29.6</div>
61 TS dt 0. time 30.1<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
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">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Thank you,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Sophie<br>
</div>
<div id="gmail-m_1734284790163750498appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_1734284790163750498divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Sent:</b> Tuesday, October 27, 2020 15:34<br>
<b>To:</b> Blondel, Sophie <<a href="mailto:sblondel@utk.edu" target="_blank">sblondel@utk.edu</a>><br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>; <a href="mailto:xolotl-psi-development@lists.sourceforge.net" target="_blank">xolotl-psi-development@lists.sourceforge.net</a> <<a href="mailto:xolotl-psi-development@lists.sourceforge.net" target="_blank">xolotl-psi-development@lists.sourceforge.net</a>><br>
<b>Subject:</b> Re: [petsc-users] TSSetEventHandler and TSSetPostEventIntervalStep</font>
<div> </div>
</div>
<div><p><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"><strong>[External Email]</strong></span></p>
<div>
<div dir="ltr">
<div dir="ltr">On Tue, Oct 27, 2020 at 3:09 PM Blondel, Sophie via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
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><br>
</div>
<div> 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><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
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">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Best,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">
Sophie<br>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>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><br>
</div>
<div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div><br></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>