From 40d9f7919784643c3a1e3ccb3f6883b1eb81e121 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Tue, 31 Jan 2012 14:16:01 -0600 Subject: Add SimpleWaveOpenCL.m --- Examples/SimpleWaveOpenCL.m | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Examples/SimpleWaveOpenCL.m (limited to 'Examples') diff --git a/Examples/SimpleWaveOpenCL.m b/Examples/SimpleWaveOpenCL.m new file mode 100644 index 0000000..cb013c7 --- /dev/null +++ b/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]; -- cgit v1.2.3