<div dir="ltr">Thanks Erik, I hadn&#39;t thought of that. I&#39;ll change my code.<div><br></div><div>Federico</div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno ven 9 giu 2017 alle ore 16:19 Erik Schnetter &lt;<a href="mailto:schnetter@cct.lsu.edu">schnetter@cct.lsu.edu</a>&gt; ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Federico<div><br></div><div>You can check the global variable Carpet::timelevel (also available via the aliased function GetTimeLevel), and do nothing unless it is zero. The time overhead of this is negligible.</div></div><div dir="ltr"><div><br></div><div>-erik</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 9, 2017 at 3:42 AM, Federico Guercilena <span dir="ltr">&lt;<a href="mailto:guercilena@th.physik.uni-frankfurt.de" target="_blank">guercilena@th.physik.uni-frankfurt.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Erik,<div><br></div><div>I understand the reasoning behind looping over the timelevels in POSTREGRID, I didn&#39;t really expect to be able to disable it.</div><div><br></div><div>My viscosity is not evolved (e.g. via MoL), but depends on the time derivative of the entropy, which I estimate using past timelevels (as a one sided, second order FD stencil, so just a linear combination of the values of the entropy at different timelevels at each grid point). After regridding the hydro variables have been interpolated/synchronized as you say, the entropy is recomputed (pointwise, no stencils involved) so that it is consistent, and the viscosity has to be recomputed as well (attempts to leave it to whatever the regridding operation did (i.e. not schedule the routine at postregrid) resulted in crashes). I also cannot schedule it later, since after timelvels are rotated I wouldn&#39;t have enough of them to computed the time derivative (unless I reduce the stencil to 1st order, but I&#39;d rather not). As I said, I have a workaround for this, it&#39;s just that it&#39;s somewhat inelegant.</div><div><br></div><div>Thanks,</div><div>Federico</div></div><div class="m_8608672156164268744HOEnZb"><div class="m_8608672156164268744h5"><br><div class="gmail_quote"><div dir="ltr">Il giorno gio 8 giu 2017 alle ore 14:50 Erik Schnetter &lt;<a href="mailto:schnetter@cct.lsu.edu" target="_blank">schnetter@cct.lsu.edu</a>&gt; ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Federico<div><br></div><div>The postregrid bin is run after regridding. All grid points on the new grid must be defined in some way -- either via interpolation (space and/or time) and boundary synchronization/prolongation, or they must be recalculated from other data. Typically, evolved quantities such as density and momentum are interpolated, and other quantities such as the pressure are defined based on the evolved quantities. This needs to happen on all time levels, hence this loop. This loop cannot be disabled, as it would leave past time levels undefined, which would lead to problems during the next boundary prolongation, as this might access past time levels for time interpolation.</div><div><br></div><div>Is your viscosity evolved, or can it be calculated from other quantities? How should its values be defined after regridding? This should probably be the same procedure as for setting up initial conditions.</div><div><br></div><div>-erik</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 8, 2017 at 8:07 AM, Federico Guercilena <span dir="ltr">&lt;<a href="mailto:guercilena@th.physik.uni-frankfurt.de" target="_blank">guercilena@th.physik.uni-frankfurt.de</a>&gt;</span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I have a viscosity grid function I want to evaluate (among other places) at CCTK_POSTREGRID, so that it&#39;s consistent and ready for use at CCTK_EVOL. Problem is, the viscosity depends on the past timelevels of another grid function (the entropy). It seems Carpet loops on the timelevels in CCTK_POSTREGRID, which means that when the loop is on the &quot;current&quot; timelevel everything works fine, but when the loop moves onto some past timelevel, the other timelevels, the ones further in the past so to speak, are undefined. In particular the code segfaults when trying to access something like entropy_p_p[ijk], since entropy_p_p does not point to a valid memory address.</div><div><br></div><div>I was able to fix this simply by checking if the pointers to past timelevels are valid, and breaking out of the function otherwise. This does the trick, but I was wondering if there&#39;s a more elegant, Cactus/Carpet native solution. My fix could maybe also slightly impact performance.</div><div><br></div><div>Is there a way to disable the loop on timelevels in CCTK_POSTREGRID (but only for a given scheduled routine)? Or to schedule something after POSTREGRID, but before timelevels are rotated? As far as I know neither is possible, but hopefully I&#39;m disregarding something.</div><div><br></div><div>Thanks,</div><div>Federico Guercilena</div></div>
<br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@einsteintoolkit.org" target="_blank">Users@einsteintoolkit.org</a><br>
<a href="http://lists.einsteintoolkit.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.einsteintoolkit.org/mailman/listinfo/users</a><br>
<br></blockquote></div></div><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br><div class="m_8608672156164268744m_-2788365399993760086m_-7577449269244318143gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Erik Schnetter &lt;<a href="mailto:schnetter@cct.lsu.edu" target="_blank">schnetter@cct.lsu.edu</a>&gt;<br><a href="http://www.perimeterinstitute.ca/personal/eschnetter/" target="_blank">http://www.perimeterinstitute.ca/personal/eschnetter/</a></div><div><br></div></div></div>
</div></blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_8608672156164268744gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Erik Schnetter &lt;<a href="mailto:schnetter@cct.lsu.edu" target="_blank">schnetter@cct.lsu.edu</a>&gt;<br><a href="http://www.perimeterinstitute.ca/personal/eschnetter/" target="_blank">http://www.perimeterinstitute.ca/personal/eschnetter/</a></div><div><br></div></div></div>
</div>
</blockquote></div>