aboutsummaryrefslogtreecommitdiff
path: root/Examples/SimpleWave.m
blob: e0cca88d67ad23a79d44075b22cd73131e5384b8 (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
<< "KrancThorn.m";

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

PD = PDstandard2nd;

groups = {{"evolved_group", {phi, pi}}};

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, ".", 
  "SimpleWave", 
  PartialDerivatives -> derivatives,
  DeclaredGroups     -> {"evolved_group"},
  Calculations       -> {initialSineCalc, evolveCalc}];