<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Roland,</p>
<p><br>
</p>
<p>Thank you very much for your answer and for pointing that out. Somehow I think that at the time, I was aware of this part of the source code, but I probably missed the fact that it is actually scheduled, even when the inverse Jacobian is not computed. So
 I guess that this really fixes my problem with checks and simplifies my life in that regard, because the parameter and flags are both set correctly then.</p>
<p><br>
</p>
<p>However, part of the reason why I thought this was not working properly, is because I was getting wrong numbers at the end of the day, but I attributed a wrong cause to it (bad memory access). Thanks to your comment about the spacing, and the piece of code
 you emphasized, I went back to doing some testing (with patch system Thornburg04nc), and I think that the problem lies in that the value assignment to the volume form is not consistent with what happens for Thornburg04 in the purely spherical part (with
<i>h </i>the spacing):</p>
<p><br>
</p>
<p></p>
<div><i>    // set volume form to deterimant of Jacobian<br>
    const CCTK_REAL det =  fabs((  J11[ijk] * J22[ijk] * J33[ijk]<br>
              + J12[ijk] * J23[ijk] * J31[ijk]<br>
              + J13[ijk] * J21[ijk] * J32[ijk]<br>
              - J11[ijk] * J23[ijk] * J32[ijk]<br>
              - J12[ijk] * J21[ijk] * J33[ijk]<br>
              - J13[ijk] * J22[ijk] * J31[ijk]));<br>
<br>
volume_form[ijk] = h[0]*h[1]*h[2]/det;</i></div>
<br>
<p></p>
<p><br>
</p>
<p>If it makes sense (and I'm not misled this time), I will instead open a bug report to change, in inverse-jacobian.F90,</p>
<p><span>    <i>volume_form(i,j,k) = detJ</i></span><br>
</p>
<p>into</p>
<p><i>    [... definition and attribution to h...]</i></p>
<p><i><span>    volume_form(i,j,k) = h(1)*h(2)*h(3) / abs(detJ)</span><i></i></i></p>
<p>which does indeed yield correct results for the volume integrals I'm computing. Also note the absolute value, because I've seen that
<i>detJ</i> can be negative and it does impact the result at the end.</p>
<p><br>
</p>
<p>Again, I've limited my tests to Thornburg04 and Thornburg04nc patch systems (and only at t=0 for the latter), for the type of simulations I'm doing. So I don't know if it breaks things somewhere outside, and if the loss of backwards compatibility on that
 quantity may be a problem.</p>
<p>But I think this should improve consistency, and hopefully fit closer to the idea of the variable. This also prevents outsourcing that calculation with the spacing in any user thorn, hence limiting the information it needs to fetch from Coordinates.</p>
<p><br>
</p>
<p>Best,</p>
<p><br>
</p>
<p>Jordan</p>
<br>
<p></p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Roland Haas <rhaas@mail.ubc.ca><br>
<b>Sent:</b> Tuesday, January 13, 2026 23:01<br>
<b>To:</b> Jordan Nicoules<br>
<b>Cc:</b> users@einsteintoolkit.org<br>
<b>Subject:</b> Re: [Users] Safe check of variable Coordinates::volume_form_state</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
CUIDADO: Email de um sistema externo. Cuidado com links, anexos e pedidos de dados/senhas.<br>
CAUTION: Email from an external system. Be careful with links, attachments, and requests for data/passwords.<br>
<br>
Hello Jordan,<br>
<br>
I took a quick look and Llama's schedule.ccl runs<br>
Coordinates_SetInverseJacobian which sets volume_form_state and also<br>
volume_form but only based on the Jacobian so does not take the grid<br>
spacing into account or overlapping cells.<br>
<br>
Thornburg04 then schedules its own routine afterwards which overwrites<br>
those results.<br>
<br>
volume_form_state      = store_volume_form<br>
[...]<br>
if (store_volume_form /= 0) then<br>
   call calc_det3 (Jac, detJ)<br>
<br>
   ! TODO: The volume form d^3x is defined as<br>
   !       d^3x = da db dc * det(dx / da) * M,<br>
   !       where M is the mask storing the nominal cell volume<br>
   volume_form(i,j,k) = detJ<br>
end if<br>
<br>
Yours,<br>
Roland<br>
<br>
> [CAUTION: Non-UBC Email]<br>
><br>
> Hi Roland,<br>
><br>
><br>
> Thank you very much for your message! I had seen the shorter version<br>
> of your reply in the minutes indeed, but thank you for giving a more<br>
> detailed answer!<br>
><br>
><br>
> When I come back from the holiday season, I will gladly file the bug<br>
> report. I would also say that this should be straightforward to fix,<br>
> at least about initializing the variable to 0 by default.<br>
><br>
><br>
> The consistency between setting the parameter<br>
> Coordinates::store_volume_form=yes and having the code still set<br>
> Coordinates::volume_form_state = 0 depending on the actual<br>
> implementation of the volume form -- if it's even needed -- might be<br>
> a different question though. For instance, I think that technically<br>
> the system Thornburg04nc should have the volume form computed, but it<br>
> doesn't. I suppose that the consistency could be handled at<br>
> ParamCheck for example. Please tell me if that would require another<br>
> subsequent bug report or not.<br>
><br>
> I would say that this renders the usage of CCTK_VarDataPtr on<br>
> Coordinates::volume_form still insufficient because its storage<br>
> relies on the parameter value, although I get your point about<br>
> abusing poisoning there. However (from the top of my head), I<br>
> remember that when I used poisoning with Llama (and MLBSSN), the<br>
> norm2 of the Hamiltonian constraint was NaN, so I had to turn it off.<br>
><br>
><br>
> Let me know if you'd like me to help on the implementation. I'm not<br>
> sure about how the process goes and what is the corresponding<br>
> involvement, so I don't want to make promises, but I'd happy to<br>
> contribute to these (hopefully easy) fixes, if it saves you more time<br>
> than it wastes.<br>
><br>
><br>
> Best wishes for the holiday season!<br>
><br>
><br>
> Jordan<br>
><br>
><br>
><br>
> ________________________________<br>
> From: Roland Haas <rhaas@mail.ubc.ca><br>
> Sent: Wednesday, December 17, 2025 6:04:41 PM<br>
> To: Jordan Nicoules<br>
> Cc: users@einsteintoolkit.org<br>
> Subject: Re: [Users] Safe check of variable<br>
> Coordinates::volume_form_state<br>
><br>
><br>
> CUIDADO: Email de um sistema externo. Cuidado com links, anexos e<br>
> pedidos de dados/senhas. CAUTION: Email from an external system. Be<br>
> careful with links, attachments, and requests for data/passwords.<br>
><br>
> Hello Jordan,<br>
><br>
> Sorry for the delayed response. This dropped off my radar after<br>
> agreeing to try and respond during the last ET call.<br>
><br>
> > I'm trying to extend our analysis thorn to tackle multipatch grids<br>
> > built with Llama. I want to use Coordinates::volume_form in the<br>
> > computation of volume integrals, by setting the corresponding<br>
> > parameter Coordinates::store_volume_form = yes.<br>
> ><br>
> ><br>
> > Our standard use case relies on Coordinates::coordinate_system =<br>
> > "Thornburg04", for which it works like a charm. However, except for<br>
> > this system and the analogous Thornburg13 (I have not tested it so<br>
> > far), it seems the variable Coordinates::volume_form_state is not<br>
> > modified nor initialized, whatever the value of the parameter<br>
> > Coordinates::store_volume_form.<br>
><br>
> That would be a bug in the Llama coordinate systems. They should all<br>
> at least set up the variable correctly. Would you mind filing a bug<br>
> report using<br>
><br>
> <a href="https://bitbucket.org/einsteintoolkit/tickets/issues/new" id="LPlnk747665" previewremoved="true">
https://bitbucket.org/einsteintoolkit/tickets/issues/new</a><br>
><br>
> > That makes the parameter insufficient<br>
> > by itself to perform checks. Moreover, since the flag is not<br>
> > initialized, we also can't simply check its value, which can be<br>
> > polluted. I have tried to use Carpet::poison_new_timelevels = yes<br>
> > and CarpetLib::poison_new_memory  = yes, but it didn't seem to<br>
> > solve the issue.<br>
><br>
> You can check if a variable has storage using the CCTK_VarDataPtr<br>
> function call<br>
> (<a href="https://einsteintoolkit.org/referencemanual/ReferenceManual.html#x1-217000doc" id="LPlnk87390">https://einsteintoolkit.org/referencemanual/ReferenceManual.html#x1-217000doc</a>)<br>
> but it won't tell you if the values found in there are sensible<br>
> (admittedly you could abuse poisoning or this).<br>
><br>
> > Hence, I would like to ask if there's another way to check for<br>
> > uninitialized values, a safe way to use the variables I mentioned in<br>
> > a general case, or any information/subtlety I may have missed?<br>
><br>
> I think you captured the intended behaviour and the bugs present.<br>
> Should be (one hopes) easy to fix at least in that all coordinate<br>
> systems should indicate correctly if the volume form is set up or now.<br>
><br>
> > Ultimately, I can directly check Coordinates::coordinate_system, and<br>
> > output a warning/error if it's not of the types mentioned above.<br>
> > That feels a bit unsatisfactory, although I may default to it.<br>
><br>
> Yes, looking at another thorns parameter is somewhat error prone, in<br>
> particular if it is a parameter that is private and thus could change<br>
> meaning at any moment.<br>
><br>
> Yours,<br>
> Roland<br>
><br>
> --<br>
> My email is as private as my paper mail. I therefore support<br>
> encrypting and signing email messages. Get my PGP key from<br>
> <a href="http://pgp.mit.edu">http://pgp.mit.edu</a> .<br>
<br>
--<br>
My email is as private as my paper mail. I therefore support encrypting<br>
and signing email messages. Get my PGP key from <a href="http://pgp.mit.edu">http://pgp.mit.edu</a> .<br>
</div>
</span></font></div>
</div>
</body>
</html>