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
69
70
71
72
|
<< "KrancThorn.m";
groups = {{"phi_g", {phi}}, {"pi_g", {pi}}, {"xCopy_g", {xCopy}}};
derivatives =
{
PDstandard2nd[i_] -> StandardCenteredDifferenceOperator[1,1,i],
PDstandard2nd[i_, i_] -> StandardCenteredDifferenceOperator[2,1,i]
};
PD = PDstandard2nd;
f[x_] := Exp[-(x/0.1)^2];
initialGaussianCalc =
{
Name -> "initial_gaussian",
Schedule -> {"AT INITIAL"},
ExecuteOn -> Host,
Equations ->
{
phi -> f[t+x],
pi -> D[f[t+x],t],
xCopy -> x
}
};
evolveCalc =
{
Name -> "calc_rhs",
Schedule -> {"in MoL_CalcRHS"},
Where -> Interior,
Equations ->
{
dot[phi] -> pi,
dot[pi] -> Euc[ui,uj] PD[phi,li,lj]
}
};
boundCalc =
{
Name -> "calc_bound_rhs",
Schedule -> {"in MoL_RHSBoundaries"},
Where -> Boundary,
Equations ->
{
dot[phi] -> D[f[t+xCopy],t],
dot[pi] -> D[f[t+xCopy],t,t]
}
};
copyCalc =
{
Name -> "copy_to_device",
Schedule -> {"at INITIAL after initial_gaussian"},
Where -> Everywhere,
ExecuteOn -> Device,
Equations ->
{
phi -> phi,
pi -> pi
}
};
CreateKrancThornTT[groups, ".",
"SimpleWaveCaKernel",
Calculations -> {initialGaussianCalc, evolveCalc, copyCalc, boundCalc},
PartialDerivatives -> derivatives,
UseCaKernel -> True,
EvolutionTimelevels -> 2,
DeclaredGroups -> {"phi_g","pi_g","xCopy_g"}];
|