aboutsummaryrefslogtreecommitdiff
path: root/Examples/WaveCaKernel.m
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2012-03-15 17:23:09 +0100
committerIan Hinder <ian.hinder@aei.mpg.de>2012-03-15 17:23:09 +0100
commitfa52744053f212b79087a40dac8c9df8d6d40158 (patch)
tree8440718606729dfcdfb9fe2030f058c2b95d96d5 /Examples/WaveCaKernel.m
parent7840f15af87fc2b070da6f49fd2ee5c0f247e78f (diff)
Replace SimpleWaveCaKernel with WaveCaKernel
This script now generates WaveCaKernel and WaveHost which do the same thing, one using CaKernel and one using the host. This allows easy cross-comparison between the two methods.
Diffstat (limited to 'Examples/WaveCaKernel.m')
-rw-r--r--Examples/WaveCaKernel.m72
1 files changed, 72 insertions, 0 deletions
diff --git a/Examples/WaveCaKernel.m b/Examples/WaveCaKernel.m
new file mode 100644
index 0000000..f4991ea
--- /dev/null
+++ b/Examples/WaveCaKernel.m
@@ -0,0 +1,72 @@
+<< "KrancThorn.m";
+
+groups = {{"phi_g", {phi}}, {"pi_g", {pi}}, {"xCopy_g", {xCopy}}};
+
+derivatives =
+{
+ PDstandard2nd[i_] -> StandardCenteredDifferenceOperator[1,1,i],
+ PDstandard2nd[i_, i_] -> StandardCenteredDifferenceOperator[2,1,i]
+};
+
+PD = PDstandard2nd;
+
+f[x_] := Exp[-(x/0.1)^2];
+
+initialGaussianCalc =
+{
+ Name -> "initial_gaussian",
+ Schedule -> {"AT INITIAL"},
+ ExecuteOn -> Host,
+ Equations ->
+ {
+ phi -> f[t+x],
+ pi -> D[f[t+x],t],
+ xCopy -> x
+ }
+};
+
+evolveCalc =
+{
+ Name -> "calc_rhs",
+ Schedule -> {"in MoL_CalcRHS"},
+ Where -> Interior,
+ Equations ->
+ {
+ dot[phi] -> pi,
+ dot[pi] -> Euc[ui,uj] PD[phi,li,lj]
+ }
+};
+
+boundCalc =
+{
+ Name -> "calc_bound_rhs",
+ Schedule -> {"in MoL_RHSBoundaries"},
+ Where -> Boundary,
+ Equations ->
+ {
+ dot[phi] -> D[f[t+xCopy],t],
+ dot[pi] -> D[f[t+xCopy],t,t]
+ }
+};
+
+
+copyCalc =
+{
+ Name -> "copy_to_device",
+ Schedule -> {"at INITIAL after initial_gaussian"},
+ Where -> Everywhere,
+ ExecuteOn -> Device,
+ Equations ->
+ {
+ phi -> phi,
+ pi -> pi
+ }
+};
+
+CreateKrancThornTT[groups, ".",
+ "SimpleWaveCaKernel",
+ Calculations -> {initialGaussianCalc, evolveCalc, copyCalc, boundCalc},
+ PartialDerivatives -> derivatives,
+ UseCaKernel -> True,
+ EvolutionTimelevels -> 2,
+ DeclaredGroups -> {"phi_g","pi_g","xCopy_g"}];