aboutsummaryrefslogtreecommitdiff
path: root/Examples/SimpleWaveOpenCL.m
blob: cb013c70dde35432b5d4b40321f859c9ee97368a (plain)
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
<< "KrancThorn.m";

groups = {{"evolved_group", {phi, 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)]
  }
};

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

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