aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Examples/EM.m144
-rw-r--r--Examples/EM_waves.par113
-rw-r--r--Examples/kranc.th1
3 files changed, 258 insertions, 0 deletions
diff --git a/Examples/EM.m b/Examples/EM.m
new file mode 100644
index 0000000..064822f
--- /dev/null
+++ b/Examples/EM.m
@@ -0,0 +1,144 @@
+
+(* Copyright 2004 Sascha Husa, Ian Hinder, Christiane Lechner
+
+ This file is part of Kranc.
+
+ Kranc is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Kranc is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Foobar; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*)
+
+Get["KrancThorn`"];
+
+SetEnhancedTimes[False];
+
+(**************************************************************************************)
+(* Derivatives *)
+(**************************************************************************************)
+
+derivatives =
+{
+ PDstandard2nd[i_] -> StandardCenteredDifferenceOperator[1,1,i],
+ PDstandard2nd[i_, i_] -> StandardCenteredDifferenceOperator[2,1,i],
+ PDstandard2nd[i_, j_] -> StandardCenteredDifferenceOperator[1,1,i] *
+ StandardCenteredDifferenceOperator[1,1,j],
+
+ PDstandard4th[i_] -> StandardCenteredDifferenceOperator[1,2,i],
+ PDstandard4th[i_, i_] -> StandardCenteredDifferenceOperator[2,2,i],
+ PDstandard4th[i_, j_] -> StandardCenteredDifferenceOperator[1,2,i] *
+ StandardCenteredDifferenceOperator[1,2,j]
+};
+
+PD = PDstandard2nd;
+
+(**************************************************************************************)
+(* Tensors *)
+(**************************************************************************************)
+
+(* Register the tensor quantities with the TensorTools package *)
+Map[DefineTensor, {El,B}];
+
+(**************************************************************************************)
+(* Groups *)
+(**************************************************************************************)
+
+(* NB This will give B the symmetries of a VECTOR, which is not correct *)
+evolvedGroups = Map[CreateGroupFromTensor, {El[la], B[la]}];
+evaluatedGroups =
+ {{"constraints", {CEl, CB}},
+ {"endens",{rho}}};
+
+declaredGroups = Join[evolvedGroups, evaluatedGroups];
+declaredGroupNames = Map[First, declaredGroups];
+
+groups = Join[declaredGroups];
+
+(**************************************************************************************)
+(* Initial data *)
+(**************************************************************************************)
+
+initialCalc =
+{
+ Name -> "EM_initial",
+ Schedule -> {"at CCTK_INITIAL"},
+ Equations ->
+ {
+ El1 -> sigma*Cos[2 Pi (x + y)] ,
+ El2 -> - (1 - sigma)*Cos[2 Pi x] - sigma*Cos[2 Pi (x + y)],
+ El3 -> 0,
+ B1 -> 0,
+ B2 -> 0,
+ B3 -> (1 - sigma)*Cos[2 Pi x] + sigma*Cos[2 Pi (x + y)]
+ }
+}
+
+(**************************************************************************************)
+(* Evolution equations *)
+(**************************************************************************************)
+
+evolCalc =
+{
+ Name -> "EM_evol",
+ Schedule -> {"in MoL_CalcRHS"},
+ Equations ->
+ {
+ dot[El[la]] -> (Eps[la,lb,lc] Euc[ub,ue] Euc[uc,uf] PD[B[lf],le]),
+ dot[B[la]] -> -(Eps[la,lb,lc] Euc[ub,ue] Euc[uc,uf] PD[El[lf],le])
+ }
+}
+
+(**************************************************************************************)
+(* Constraint equations *)
+(**************************************************************************************)
+
+constraintsCalc =
+{
+ Name -> "EM_constraints",
+ Equations ->
+ {
+ CEl -> PD[El[la],lb] Euc[ua,ub], CB -> PD[B[la],lb] Euc[ua,ub]
+ }
+}
+
+(**************************************************************************************)
+(* Energy equation *)
+(**************************************************************************************)
+
+energyCalc =
+{
+ Name -> "EM_energy",
+ Equations ->
+ {
+ rho -> El[la] El[ua]/2 + B[la] B[ua]/2
+ }
+}
+
+realParameters = {sigma};
+
+(**************************************************************************************)
+(* Construct the thorn *)
+(**************************************************************************************)
+
+calculations =
+{
+ initialCalc,
+ evolCalc,
+ constraintsCalc,
+ energyCalc
+};
+
+CreateKrancThornTT[groups, ".", "EM",
+ Calculations -> calculations,
+ DeclaredGroups -> declaredGroupNames,
+ PartialDerivatives -> derivatives,
+ RealParameters -> realParameters];
diff --git a/Examples/EM_waves.par b/Examples/EM_waves.par
new file mode 100644
index 0000000..010dd14
--- /dev/null
+++ b/Examples/EM_waves.par
@@ -0,0 +1,113 @@
+#!/usr/bin/perl -W
+
+ActiveThorns = "
+Boundary
+Carpet
+CarpetIOASCII
+CarpetIOBasic
+CarpetIOScalar
+CarpetLib
+CarpetReduce
+CarpetSlab
+CartGrid3d
+CoordBase
+GenericFD
+IOUtil
+LoopControl
+MoL
+NanChecker
+Periodic
+EM
+Slab
+SymBase
+Time
+"
+
+#############################################################
+# Grid
+#############################################################
+
+CoordBase::domainsize = minmax
+
+CoordBase::xmin = 0
+CoordBase::ymin = 0
+CoordBase::zmin = 0
+
+CoordBase::xmax = 1
+CoordBase::ymax = 0.1
+CoordBase::zmax = 0.1
+
+CoordBase::dx = 0.05
+CoordBase::dy = 0.1
+CoordBase::dz = 0.1
+
+CoordBase::boundary_size_x_lower = 1
+CoordBase::boundary_size_y_lower = 1
+CoordBase::boundary_size_z_lower = 1
+CoordBase::boundary_shiftout_x_lower = 1
+CoordBase::boundary_shiftout_y_lower = 1
+CoordBase::boundary_shiftout_z_lower = 1
+
+CoordBase::boundary_size_x_upper = 1
+CoordBase::boundary_size_y_upper = 1
+CoordBase::boundary_size_z_upper = 1
+CoordBase::boundary_shiftout_x_upper = 0
+CoordBase::boundary_shiftout_y_upper = 0
+CoordBase::boundary_shiftout_z_upper = 0
+
+CartGrid3D::type = "coordbase"
+CartGrid3D::domain = "full"
+CartGrid3D::avoid_origin = "no"
+
+Periodic::periodic = "yes"
+
+#############################################################
+# Carpet
+#############################################################
+
+Carpet::ghost_size = 1
+Carpet::domain_from_coordbase = "yes"
+Carpet::max_refinement_levels = 1
+#Carpet::init_each_timelevel = "yes"
+Carpet::num_integrator_substeps = 4
+
+#############################################################
+# Time integration
+#############################################################
+
+Cactus::terminate = "time"
+Cactus::cctk_final_time = 1
+
+Time::dtfac = 0.5
+MethodOfLines::ode_method = "RK4"
+MethodOfLines::MoL_Intermediate_Steps = 4
+MethodOfLines::MoL_Num_Scratch_Levels = 1
+MethodOfLines::MoL_NaN_Check = "yes"
+
+#############################################################
+# Boundary conditions
+#############################################################
+
+EM::El_group_bound = "none"
+EM::B_group_bound = "none"
+
+#############################################################
+# Output
+#############################################################
+
+IO::out_dir = $parfile
+IO::out_fileinfo = "all"
+
+CarpetIOBasic::outInfo_every = 1
+CarpetIOBasic::outInfo_vars = "EM::CEl EM::CB"
+
+CarpetIOScalar::outScalar_every = 1
+CarpetIOScalar::outScalar_vars = "EM::El1 EM::B1 EM::CEl EM::CB EM::rho"
+CarpetIOScalar::outScalar_reductions = "minimum maximum norm2"
+
+IOASCII::out1D_every = 1
+IOASCII::out1D_x = "yes"
+IOASCII::out1D_vars = "EM::El2 EM::El1 EM::B1 EM::B3 EM::CEl EM::CB EM::rho"
+
+CarpetIOASCII::out_precision = 19
+CarpetIOASCII::out3D_ghosts = "yes"
diff --git a/Examples/kranc.th b/Examples/kranc.th
index d55ff47..0a5a3ce 100644
--- a/Examples/kranc.th
+++ b/Examples/kranc.th
@@ -62,3 +62,4 @@ Carpet/LoopControl
KrancNumericalTools/GenericFD
KrancExamples/Wave
KrancExamples/SimpleWave
+KrancExamples/EM