aboutsummaryrefslogtreecommitdiff
path: root/m
diff options
context:
space:
mode:
authortbode <tbode@4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843>2010-05-07 00:59:10 +0000
committertbode <tbode@4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843>2010-05-07 00:59:10 +0000
commitb3aafc21d0044b4d68ee7a6c088c472799ed9503 (patch)
tree3da4d04b0e3acc44f6b8e5feaf34c62095c05eea /m
parentf33a18fee7267ff212baec75795ecb13670643e8 (diff)
WeylScal4:
Remove variable modifications in Kranc script. Fix tensor parity tags. Add old-style BC compatibility. Add intelligence to runmath.sh in finding Kranc. Change bash script permissions. Add testsuites. Expand README description. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/WeylScal4/trunk@52 4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843
Diffstat (limited to 'm')
-rw-r--r--m/Makefile3
-rw-r--r--m/WeylScal4.m82
-rwxr-xr-x[-rw-r--r--]m/copy-if-changed.sh11
-rwxr-xr-x[-rw-r--r--]m/runmath.sh42
4 files changed, 106 insertions, 32 deletions
diff --git a/m/Makefile b/m/Makefile
index a55d24f..e9bf163 100644
--- a/m/Makefile
+++ b/m/Makefile
@@ -8,7 +8,8 @@ all: WeylScal4.out
WeylScal4.out: WeylScal4.m
rm -rf WeylScal4
./runmath.sh $^
- for thorn in WeylScal*; do \
+ patch -p1 -d WeylScal4 <WeylScal4.patch
+ for thorn in WeylScal4; do \
./copy-if-changed.sh $$thorn/configuration.ccl ../../$$thorn/configuration.ccl && \
./copy-if-changed.sh $$thorn/interface.ccl ../../$$thorn/interface.ccl && \
./copy-if-changed.sh $$thorn/param.ccl ../../$$thorn/param.ccl && \
diff --git a/m/WeylScal4.m b/m/WeylScal4.m
index eed4fae..4c373ec 100644
--- a/m/WeylScal4.m
+++ b/m/WeylScal4.m
@@ -1,5 +1,4 @@
-$Path = Join[$Path, {"~/Calpha/kranc/Tools/CodeGen",
- "~/Calpha/kranc/Tools/MathematicaMisc"}];
+$Path = Join[$Path, Map[ToString, ReadList[StringToStream[Environment["MATHPATH"]], Word, WordSeparators->{":"}]]];
$RecursionLimit = 1000;
@@ -48,16 +47,19 @@ derivatives =
Map[DefineTensor,
{
R, gamma,g, gInv, k, ltet, n, rm, im, rmbar, imbar, tn, va, vb, vc,
+ wa, wb, wc, ea, eb, ec,
Ro, Rojo, R4p, Psi0r, Psi0i, Psi1r, Psi1i, Psi2r, Psi2i, Psi3r,
Psi3i, Psi4r,Psi4i
}];
-SetTensorAttribute[Psi0r, TensorManualCartesianParities, {1,1,1}];
-SetTensorAttribute[Psi2r, TensorManualCartesianParities, {1,1,1}];
-SetTensorAttribute[Psi4r, TensorManualCartesianParities, {1,1,1}];
-SetTensorAttribute[Psi0i, TensorManualCartesianParities, {-1,-1,-1}];
-SetTensorAttribute[Psi2i, TensorManualCartesianParities, {-1,-1,-1}];
-SetTensorAttribute[Psi4i, TensorManualCartesianParities, {-1,-1,-1}];
+(* Psi0,2,4 behave as (pseudo)scalars *)
+SetTensorAttribute[Psi0r, TensorParity, +1];
+SetTensorAttribute[Psi2r, TensorParity, +1];
+SetTensorAttribute[Psi4r, TensorParity, +1];
+SetTensorAttribute[Psi0i, TensorParity, -1];
+SetTensorAttribute[Psi2i, TensorParity, -1];
+SetTensorAttribute[Psi4i, TensorParity, -1];
+(* these are 'special' and require a patch to the symmetry thorns *)
SetTensorAttribute[Psi1r, TensorManualCartesianParities, {1,1,-1}];
SetTensorAttribute[Psi3r, TensorManualCartesianParities, {-1,-1,1}];
SetTensorAttribute[Psi1i, TensorManualCartesianParities, {-1,-1,1}];
@@ -109,6 +111,7 @@ shorthands =
gamma[ua,lb,lc], R[la,lb,lc,ld], invdetg, detg, third, detgmthirdroot,
gInv[ua,ub], Ro[la,lb,lc], Rojo[la,lb], R4p[li,lj,lk,ll],
omega11, omega22, omega33, omega12, omega13, omega23, va[ua], vb[ua], vc[ua],
+ wa[ua], wb[ua], wc[ua], ea[ua], eb[ua], ec[ua],
tn[ua], nn, ltet[ua],n[ua],rm[ua],im[ua],rmbar[ua],imbar[ua], isqrt2, xmoved,
ymoved, zmoved
};
@@ -121,7 +124,7 @@ realParameters = {{Name -> offset, Default -> 10^(-15)},xorig,yorig,zorig};
PsisCalc[fdOrder_, PD_] :=
{
Name -> "psis_calc_" <> fdOrder,
- Schedule -> {"at CCTK_EVOL after MoL_Evolution after evolved_to_adm as calc_np"},
+ Schedule -> {"in WeylScal4_Calculate as calc_np"},
Where -> Interior,
ConditionalOnKeyword -> {"fd_order", fdOrder},
Shorthands -> shorthands,
@@ -151,28 +154,29 @@ PsisCalc[fdOrder_, PD_] :=
(* Orthonormalize using Gram-Schmidt*)
- omega11 -> va[ua] va[ub] g[la,lb],
- va[ua] -> va[ua] / Sqrt[omega11],
+ wa[ua] -> va[ua],
+ omega11 -> wa[ua] wa[ub] g[la,lb],
+ ea[ua] -> wa[ua] / Sqrt[omega11],
- omega12 -> va[ua] vb[ub] g[la,lb],
- vb[ua] -> vb[ua] - omega12 va[ua],
- omega22 -> vb[ua] vb[ub] g[la,lb],
- vb[ua] -> vb[ua]/Sqrt[omega22],
+ omega12 -> ea[ua] vb[ub] g[la,lb],
+ wb[ua] -> vb[ua] - omega12 ea[ua],
+ omega22 -> wb[ua] wb[ub] g[la,lb],
+ eb[ua] -> wb[ua]/Sqrt[omega22],
- omega13 -> va[ua] vc[ub] g[la,lb],
- omega23 -> vb[ua] vc[ub] g[la,lb],
- vc[ua] -> vc[ua] - omega13 va[ua] - omega23 vb[ua],
- omega33 -> vc[ua] vc[ub] g[la,lb],
- vc[ua] -> vc[ua]/Sqrt[omega33],
+ omega13 -> ea[ua] vc[ub] g[la,lb],
+ omega23 -> eb[ua] vc[ub] g[la,lb],
+ wc[ua] -> vc[ua] - omega13 ea[ua] - omega23 eb[ua],
+ omega33 -> wc[ua] wc[ub] g[la,lb],
+ ec[ua] -> wc[ua]/Sqrt[omega33],
(* Create Spatial Portion of Null Tetrad *)
isqrt2 -> 0.7071067811865475244,
- ltet[ua] -> isqrt2 vb[ua],
- n[ua] -> - isqrt2 vb[ua],
- rm[ua] -> isqrt2 vc[ua],
- im[ua] -> isqrt2 va[ua],
- rmbar[ua] -> isqrt2 vc[ua],
- imbar[ua] -> -isqrt2 va[ua],
+ ltet[ua] -> isqrt2 eb[ua],
+ n[ua] -> - isqrt2 eb[ua],
+ rm[ua] -> isqrt2 ec[ua],
+ im[ua] -> isqrt2 ea[ua],
+ rmbar[ua] -> isqrt2 ec[ua],
+ imbar[ua] -> -isqrt2 ea[ua],
(* nn here is the projection of both l^a and n^a with u^a (the time-like unit
vector normal to the hypersurface). We do NOT save the t component of the
@@ -266,6 +270,29 @@ PsisCalc[fdOrder_, PD_] :=
}
};
+(* Dummy calculation routine to fool Kranc into thinking that the Weyl scalars
+ are evolved quantities. This way we get code to register boundary conditions.
+ Unfortunately it also registers with MoL so we have to remove that code by hand.
+*)
+DummyCalc :=
+{
+ Name -> "dummycalc",
+ Schedule -> {"in Nowhere_Nevertoberun"},
+ Equations ->
+ {
+ dot[Psi4r] -> 0,
+ dot[Psi4i] -> 0 (*,
+ dot[Psi3r] -> 0,
+ dot[Psi3i] -> 0,
+ dot[Psi2r] -> 0,
+ dot[Psi2i] -> 0,
+ dot[Psi1r] -> 0,
+ dot[Psi1i] -> 0,
+ dot[Psi0r] -> 0,
+ dot[Psi0i] -> 0 *)
+ }
+}
+
(****************************************************************************
Construct the thorn
****************************************************************************)
@@ -285,7 +312,8 @@ keywordParameters =
calculations =
{
PsisCalc["2nd", PDstandard2nd],
- PsisCalc["4th", PDstandard4th]
+ PsisCalc["4th", PDstandard4th],
+ DummyCalc
};
CreateKrancThornTT[groups, ".", "WeylScal4",
diff --git a/m/copy-if-changed.sh b/m/copy-if-changed.sh
index a8403d0..d46490f 100644..100755
--- a/m/copy-if-changed.sh
+++ b/m/copy-if-changed.sh
@@ -19,7 +19,7 @@ if test -f $src; then
# Both $src and $dst must be files.
- test -f $dst || exit 3
+ test -f $dst || ! test -e $dst || exit 3
# Copy file if it differs
srcfile=$src
@@ -49,7 +49,10 @@ if test -d $src; then
test -e $dst || mkdir -p $dst
test -d $dst || exit 3
-
+
+ # find inode number to identify the src directory later on
+ srcinode=$(ls -id $src | awk '{print $1}')
+
# Create all directories
for dir in $(cd $src && find . -type d); do
dstdir=$dst/$dir
@@ -62,7 +65,7 @@ if test -d $src; then
done
# Delete directories which do not exist
- for dir in $(cd $dst && find . -name 'CVS' -prune -name '.svn' -prune -name '.git' -prune -name '.hg' -prune -name '_darcs' -prune -type d -print); do
+ for dir in $(cd $dst && find . \( -name 'CVS' -o -name '.svn' -o -name '.git' -o -name '.hg' -o -name '_darcs' -o -inum $srcinode \) -prune -o -type d -print); do
srcdir=$src/$dir
dstdir=$dst/$dir
if test -d $srcdir; then
@@ -86,7 +89,7 @@ if test -d $src; then
done
# Delete files which do not exist
- for file in $(cd $dst && find . -name 'CVS' -prune -name '.svn' -prune -name '.git' -prune -name '.hg' -prune -name '_darcs' -prune -type f -print); do
+ for file in $(cd $dst && find . \( -name 'CVS' -o -name '.svn' -o -name '.git' -o -name '.hg' -o -name '_darcs' -o -inum $srcinode \) -prune -o -type f -print); do
srcfile=$src/$file
dstfile=$dst/$file
if test -e $srcfile; then
diff --git a/m/runmath.sh b/m/runmath.sh
index 306b2e1..b9a7bbf 100644..100755
--- a/m/runmath.sh
+++ b/m/runmath.sh
@@ -2,6 +2,8 @@
# Abort on errors
set -e
+# null-expand non-matching globs
+set -u
MATHEMATICA="math"
@@ -13,6 +15,46 @@ if test -z "$script"; then
exit 2
fi
+KRANCPATH="${KRANCPATH:+$KRANCPATH}"
+if [ -z "$KRANCPATH" ] ; then
+ KRANCPATHS=(. ../../../../arrangements/.. ../../../arrangements/.. $HOME)
+ # look for Kranc in a number of likely locations
+ # choice 2 and 3 are $CCTK_HOME if the thorn resides in arrangements or
+ # git-repos
+ for i in ${KRANCPATHS[@]} ; do
+ if [ -d $i/kranc/Tools ] ; then
+ KRANCPATH=$i/kranc
+ break
+ elif [ -d $i/Kranc/Tools ] ; then
+ KRANCPATH=$i/Kranc
+ break
+ fi
+ done
+fi
+if [ -z "$KRANCPATH" ] ; then # try some more clever things...
+ KRANCBIN="$(which kranc || true)"
+ if [ -h "$KRANCBIN" ] ; then
+ KRANCBIN=$(readlink "$KRANCBIN")
+ fi
+ if [ -d "$(dirname "$KRANCBIN")/../Tools" ] ; then
+ KRANCPATH="$(dirname "$KRANCBIN")/.."
+ fi
+fi
+if [ -n "$KRANCPATH" ] ; then
+ LOCALKRANCPATH="$KRANCPATH/Tools/CodeGen:$KRANCPATH/Tools/MathematicaMisc"
+
+ if [ -z "${MATHPATH:+}" ]
+ then
+ MATHPATH=$LOCALKRANCPATH
+ else
+ MATHPATH=$LOCALKRANCPATH:$MATHPATH
+ fi
+
+ export MATHPATH
+else
+ echo -e "Could not find Kranc. Expect trouble unless you have made sure Mathematica\nwill find Kranc. You might also consider setting \$KRANCPATH."
+fi
+
error=$(basename $script .m).err
output=$(basename $script .m).out