Using Kranc

There is online HTML documentation for Kranc. This is also available in the Doc directory of Kranc in LaTeX format. Type "make KrancDoc.pdf" to make the PDF version, or "make KrancDoc.html" to make the HTML version.


There is a tutorial to guide you through the process of downloading Cactus and Kranc, installing Kranc into Cactus, and generating your first Kranc thorn.


We provide several example scripts which can be adapted to develop your own codes. The short script SimpleWave.m (available in the Kranc package as Kranc/Examples/SimpleWave.m) generates a wave equation code.

You can run the script using:

cd Kranc/Examples
../Bin/kranc SimpleWave.m

It generates a Cactus thorn directory SimpleWave. You can download SimpleWave.tar.gz to see the code that is generated.


<< "KrancThorn.m";

groups = evolved_group};

derivatives =
  PDstandard2nd[i_] -> StandardCenteredDifferenceOperator[1,1,i],
  PDstandard2nd[i_, i_] -> StandardCenteredDifferenceOperator[2,1,i]

PD = PDstandard2nd;

initialSineCalc = 
  Name -> "initial_sine",
  Schedule -> {"AT INITIAL"},
  Equations -> 
    phi -> Sin[2 Pi (x - t)],
    pi -> -2 Pi Cos[2 Pi (x - t)]

evolveCalc = 
  Name -> "calc_rhs",
  Schedule -> {"in MoL_CalcRHS"},
  Equations ->
    dot[phi] -> pi,
    dot[pi]  -> Euc[ui,uj] PD[phi,li,lj]

CreateKrancThornTT[groups, ".", 
  Calculations -> {initialSineCalc, evolveCalc},
  PartialDerivatives -> derivatives,
  DeclaredGroups -> {"evolved_group"}];