On 17 Aug 2015, at 22:23, Eloisa Bentivegna <[email protected]>
wrote:
> On 17/08/15 21:09, Comer Duncan wrote:
>> Hi,
>>
>> I am trying to make a Kranc file to build a thorn to make a Brill wave
>> using CT_Cosmology. I am bogged down with errors in the script and
>> would appreciate some help in getting the thing to work. I am attaching
>> the script and the output err file. Basically what I am trying to do is
>> to build a single kranc file to handle the specification of the initial
>> metric and extrinsic curvature and have the Hamiltonian constraint
>> solved using the CT_Cosmology thorn CT_Multilevel. I have been trying
>> to copy existing thorns but have not been able to iron out the problems.
>
> Hi Comer!
>
> I notice that you use an underscore in one of your calculation names.
> This will almost certainly interfere with the way Mathematica uses
> underscores and should be avoided. You can, for instance, simply call
> the calculation "BrillAnalyticCalc".
Yes, that seems to be the problem. When you define a calculation, you usually
assign it to a Mathematica variable so that it can be referred to later in the
arguments to CreateThornTT. In Comer's example, this Mathematica variable has
an underscore, i.e.
CT_BrillAnalyticCalc =
{
Name -> ThornName ,
...
}
where ThornName has been previously defined. This is "bad" because the
underscore is used by Mathematica to indicate patterns, so CT_BrillAnalyticCalc
is interpreted as Pattern[CT,Blank[BrillAnalyticCalc]]. i.e.
In[560]:= FullForm[CT_BrillAnalyticCalc]
Out[560]//FullForm= Pattern[CT,Blank[BrillAnalyticCalc]]
By using an underscore on the left hand side of an assignment, you are actually
telling Mathematica to create a rule for replacing expressions with head
BrillAnalyticCalc. I don't think there's any way that Kranc can detect this
sort of error, as it might be something you are legitimately using in the Kranc
script (which is just a Mathematica program calling CreateThorn from Kranc,
which could be thought of as a library). Probably the error message could be
more explicit if the value passed is a pattern, and warn the user not to use
underscores in variable names. I have created an issue
(https://github.com/ianhinder/Kranc/issues/130) for this. This was part of the
motivation for the "script language" (pre-production, do not use yet!) where we
define an entirely new syntax, which is very restrictive. i.e. it can only
express Kranc calculations; you cannot write generic programs which produce
your thorn. Ideally, users could start with this, which would have much more
stringent error checking available, and only if they wanted to apply more
"programmatic" code generation, would they use Kranc from the Mathematica API.
--
Ian Hinder
http://members.aei.mpg.de/ianhin
_______________________________________________
Users mailing list
[email protected]
http://lists.einsteintoolkit.org/mailman/listinfo/users