<div dir="ltr">I'm not sure if (<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TS2GetSolution.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TS2GetSolution.html</a>) would work but you just cache the norm of the solution or the whole solution in the monitor method and declare convergence when the solution does not change much.<div><br></div><div>There is probably a better way to do this but this is one way.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 30, 2021 at 7:36 PM Salazar De Troya, Miguel <<a href="mailto:salazardetro1@llnl.gov">salazardetro1@llnl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="gmail-m_6580846653497042621WordSection1">
<p class="MsoNormal">Thanks, can you elaborate on computing the time derived? TSMonitor only gives me the information at the current time step. I guess I could store a copy of the solution in the context so I can use it in the next call to compute the difference.
On the other hand, I could also store the norm of the RHS function (since this is equal to the time derivative \frac{\partial \phi}{\partial t}).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Miguel<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal" style="margin-left:0.5in"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Date: </b>Friday, April 30, 2021 at 3:56 PM<br>
<b>To: </b>"Salazar De Troya, Miguel" <<a href="mailto:salazardetro1@llnl.gov" target="_blank">salazardetro1@llnl.gov</a>><br>
<b>Cc: </b>"Zhang, Hong via petsc-users" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject: </b>Re: [petsc-users] Detecting steady-state with TS<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">You could add a <a href="https://urldefense.us/v3/__https:/www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSMonitorSet.html__;!!G2kpM7uM-TzIFchu!hG6eR--4AkxoFHnPn3N8DJF2pPoVkaJT0f6vy9E2qTLMZ0TiqDR_kr5wbAbwapvuLtnSGw$" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSMonitorSet.html</a>
method, compute the time derived and decide how to declare converged.<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">Then set converged (<a href="https://urldefense.us/v3/__https:/www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetConvergedReason.html__;!!G2kpM7uM-TzIFchu!hG6eR--4AkxoFHnPn3N8DJF2pPoVkaJT0f6vy9E2qTLMZ0TiqDR_kr5wbAbwaptYI8kTFA$" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetConvergedReason.html</a>)
with TS_CONVERGED_USER<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">That should cause TS to wrap up the solve and exit cleanly.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">Mark<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">On Thu, Apr 29, 2021 at 3:27 PM Salazar De Troya, Miguel via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">
I am solving the signed distance equation<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
\frac{\partial \phi}{\partial t} + sign (\phi_{0})(|\nabla \phi| - 1) = 0<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
using a Local Discontinuous Galerkin (LDG) method as described in <a href="https://urldefense.us/v3/__https:/www.sciencedirect.com/science/article/pii/S0021999110005255__;!!G2kpM7uM-TzIFchu!hG6eR--4AkxoFHnPn3N8DJF2pPoVkaJT0f6vy9E2qTLMZ0TiqDR_kr5wbAbwapsr29KQOw$" target="_blank">
https://www.sciencedirect.com/science/article/pii/S0021999110005255</a><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
I am interested in solving it close to steady state. I was hoping I could measure how close to steady state the solution is by using the TSSetEventHandler infrastructure, but the handler does not have information on the time derivative. I looked at TSPSEUDO,
but it forces me to use an implicit method, which I cannot provide because how the LDG method works (it calculates the fluxes solving additional equations). This makes me wonder if the LDG method is the best choice, so I am open to suggestions.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Given my current progress with the LDG approach, I am wondering if there is a way to solve to steady state using explicit algorithms such as Runge-Kutta.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Thanks<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Miguel<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<span lang="ES" style="font-size:9pt;font-family:Consolas;color:black">Miguel A. Salazar de Troya</span><u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:0.5in">
<span style="font-size:9pt;font-family:Consolas;color:black">Postdoctoral Researcher, Lawrence Livermore National Laboratory</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">
<span style="font-size:9pt;font-family:Consolas;color:black">B141</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">
<span style="font-size:9pt;font-family:Consolas;color:black">Rm: 1085-5</span><u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0.5in">
<span style="font-size:9pt;font-family:Consolas;color:black">Ph: 1(925) 422-6411</span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote></div>