Skip to content

Commit

Permalink
Add SimpleWaveOpenCL.m
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Jan 31, 2012
1 parent ff5d640 commit 40d9f79
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Examples/SimpleWaveOpenCL.m
@@ -0,0 +1,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];

0 comments on commit 40d9f79

Please sign in to comment.