1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<< "KrancThorn.m";
groups = {{"phi_g", {phi}}, {"pi_g", {pi}}};
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)]
}
};
f[x_] := Exp[-(x/0.1)^2];
initialGaussianCalc =
{
Name -> "initial_gaussian",
Schedule -> {"AT INITIAL"},
Equations ->
{
phi -> f[t+x],
pi -> D[f[t+x],t]
}
};
evolveCalc =
{
Name -> "calc_rhs",
Schedule -> {"at EVOL"},
Where -> Interior,
Equations ->
{
dot[phi] -> pi,
dot[pi] -> Euc[ui,uj] PD[phi,li,lj]
}
};
integrateCalc =
{
Name -> "rk1",
Schedule -> {"at EVOL after calc_rhs"},
Where -> Interior,
Equations ->
{
phi -> phi + dt dot[phi],
pi -> pi + dt dot[pi]
}
};
CreateKrancThornTT[groups, ".",
"SimpleWaveCaKernel",
Calculations -> {initialGaussianCalc, evolveCalc, integrateCalc},
PartialDerivatives -> derivatives,
UseCaKernel -> True,
EvolutionTimelevels -> 1,
DeclaredGroups -> {"phi_g","pi_g"}];
|