Open eschnett opened 13 years ago
I like this idea. You could provide a CommonEquations option to CreateKrancThorn which contained all the definitions as they are currently given in each individual calculation. Then when you refer to one of these in a calculation, Kranc would add the required entry from the CommonEquations (and any that it depends on) to the calculation. I'm a bit worried about intermediate shorthands that would be defined in CommonEquations which might potentially clash with those used in a calculation. We could introduce a check to prevent anything defined in CommonEquations being defined in any calculation.
Would it be enough to apply this to shorthands only, or does it need to work for gridfunctions as well? I would be worried about potentially setting gridfunctions accidentally if you could have gridfunctions in CommonEquations.
It would be nice if Kranc allowed defining tensor quantities globally, such as e.g. gu[ua,ub] or Rt[la,lb]. In this way, they would need to be defined only once, not once per calculation, and their different definitions could not become inconsistent.
This would in the end also allow replacing the "equations" of a calculation with just the list of quantities to be calculated, as their definitions would be available elsewhere.