From 7d98be4ac485a53a03e9a2170f551e5905610fe4 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Thu, 23 Sep 2010 17:28:46 +0200 Subject: Examples: Add SimpleWave example --- Examples/SimpleWave.m | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Examples/SimpleWave.m (limited to 'Examples/SimpleWave.m') diff --git a/Examples/SimpleWave.m b/Examples/SimpleWave.m new file mode 100644 index 0000000..1fbee69 --- /dev/null +++ b/Examples/SimpleWave.m @@ -0,0 +1,39 @@ +<< "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"}, + Equations -> + { + dot[phi] -> pi, + dot[pi] -> Euc[ui,uj] PD[phi,li,lj] + } +}; + +CreateKrancThornTT[groups, ".", + "SimpleWave", + Calculations -> {initialSineCalc, evolveCalc}, + PartialDerivatives -> derivatives, + DeclaredGroups -> {"evolved_group"}]; -- cgit v1.2.3