From f4406d8869f626808e5aeb26a258727eba9b4442 Mon Sep 17 00:00:00 2001 From: schnetter Date: Sat, 23 Jan 2010 20:12:37 +0000 Subject: Add "static" as synonym to "none" to metric evolution keywords. The gauges already use the "static" keyword for this. Rename some methods to have proper capitalisation, e.g. from "SetDtlapse" to "SetDtLapse". Initialise DtLapse and DtShift to zero if these initial conditions are chosen. ADMBase already initialises metric, lapse, and shift when Minkowski initial conditions are chosen. Evolve all ADMBase variables if they have the evolution method "static", which is offered by ADMBase. This evolution copies the past to the current time level in cctk_prestep, which works with and without CactusBase/MoL. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinBase/ADMBase/trunk@48 d576a68a-b34a-40ae-82fc-004fa1a9d16f --- param.ccl | 5 +- schedule.ccl | 77 ++++++++++++++++++++----------- src/Initialisation.c | 128 +++++++++++++++++++++++++++++++++++++++++++-------- src/Static.c | 72 +++++++++++++++++++++++++++++ src/make.code.defn | 2 +- 5 files changed, 235 insertions(+), 49 deletions(-) create mode 100644 src/Static.c diff --git a/param.ccl b/param.ccl index 88f8a88..4e34d41 100644 --- a/param.ccl +++ b/param.ccl @@ -35,8 +35,9 @@ KEYWORD initial_dtshift "Initial dtshift value" KEYWORD evolution_method "The metric an extrinsic curvature evolution method" { - "none" :: "metric and extrinsic curvature are not evolved" -} "none" + "none" :: "The metric and extrinsic curvature are not evolved" + "static" :: "The metric and extrinsic curvature are not evolved" +} "static" KEYWORD lapse_evolution_method "The lapse evolution method" { diff --git a/schedule.ccl b/schedule.ccl index 200f405..61274db 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -61,70 +61,91 @@ else } "Set the shift_state variable to 0" } -# Initial data for the shift - -if(CCTK_Equals(initial_shift, "zero")) +# Do we have storage for dtlapse? +if (! CCTK_Equals(initial_dtlapse, "none")) { - SCHEDULE ADMBase_ShiftZero in ADMBase_InitialGauge + SCHEDULE ADMBase_SetDtLapseStateOn at CCTK_BASEGRID { LANG: C - } "Set the shift to 0 at all points" + } "Set the dtlapse_state variable to 1" } - -# Do we have storage for dtlapse ? -if (!CCTK_Equals(initial_dtlapse, "none")) +else { STORAGE: dtlapse[1] + SCHEDULE ADMBase_SetDtLapseStateOff at CCTK_BASEGRID + { + LANG: C + } "Set the dtlapse_state variable to 0" +} - SCHEDULE ADMBase_SetDtlapseStateOn at CCTK_BASEGRID +# Do we have storage for dtshift? +if (! CCTK_Equals(initial_dtshift, "none")) +{ + SCHEDULE ADMBase_SetDtShiftStateOn at CCTK_BASEGRID { LANG: C - } "Set the dtlapse_state variable to 1" + } "Set the dtshift_state variable to 1" } else { - SCHEDULE ADMBase_SetDtlapseStateOff at CCTK_BASEGRID + SCHEDULE ADMBase_SetDtShiftStateOff at CCTK_BASEGRID { LANG: C - } "Set the dtlase_state variable to 0" + } "Set the dtshift_state variable to 0" } -# Initial data for dtlapse - -if(CCTK_Equals(initial_dtlapse, "zero")) +# Initial data for the shift +if (CCTK_Equals(initial_shift, "zero")) { - SCHEDULE ADMBase_DtlapseZero in ADMBase_InitialGauge + SCHEDULE ADMBase_ShiftZero in ADMBase_InitialGauge { LANG: C - } "Set dtlapse to 0 at all points" + } "Set the shift to 0 at all points" } -# Do we have storage for dtshift ? -if (!CCTK_Equals(initial_dtshift, "none")) +# Initial data for dtlapse +if (CCTK_Equals(initial_dtlapse, "zero")) { STORAGE: dtshift[1] + SCHEDULE ADMBase_DtLapseZero in ADMBase_InitialGauge + { + LANG: C + } "Set the dtlapse to 0 at all points" +} - SCHEDULE ADMBase_SetDtshiftStateOn at CCTK_BASEGRID +# Initial data for dtshift +if (CCTK_Equals(initial_dtshift, "zero")) +{ + SCHEDULE ADMBase_DtShiftZero in ADMBase_InitialGauge { LANG: C - } "Set the dtshift_state variable to 1" + } "Set the dtshift to 0 at all points" } -else + + + +if (CCTK_Equals(lapse_evolution_method, "static")) { - SCHEDULE ADMBase_SetDtshiftStateOff at CCTK_BASEGRID + SCHEDULE ADMBase_LapseStatic in CCTK_PRESTEP { LANG: C - } "Set the dtlase_state variable to 0" + } "Copy the lapse to the current time level" } -# Initial data for dtshift +if (CCTK_Equals(shift_evolution_method, "static")) +{ + SCHEDULE ADMBase_ShiftStatic in CCTK_PRESTEP + { + LANG: C + } "Copy the shift to the current time level" +} -if(CCTK_Equals(initial_dtshift, "zero")) +if (CCTK_Equals(evolution_method, "static") || CCTK_Equals(evolution_method, "none")) { - SCHEDULE ADMBase_DtshiftZero in ADMBase_InitialGauge + SCHEDULE ADMBase_Static in CCTK_PRESTEP { LANG: C - } "Set dtshift to 0 at all points" + } "Copy the metric and extrinsic curvature to the current time level" } # FIXME: Remove this when symmetries done better diff --git a/src/Initialisation.c b/src/Initialisation.c index f24c672..10fae5e 100644 --- a/src/Initialisation.c +++ b/src/Initialisation.c @@ -33,15 +33,15 @@ CCTK_FILEVERSION(CactusEinstein_ADMBase_Initialisation_c) void ADMBase_CartesianMinkowski(CCTK_ARGUMENTS); void ADMBase_LapseOne(CCTK_ARGUMENTS); void ADMBase_ShiftZero(CCTK_ARGUMENTS); -void ADMBase_DtlapseZero(CCTK_ARGUMENTS); -void ADMBase_DtshiftZero(CCTK_ARGUMENTS); +void ADMBase_DtLapseZero(CCTK_ARGUMENTS); +void ADMBase_DtShiftZero(CCTK_ARGUMENTS); void ADMBase_SetShiftStateOn(CCTK_ARGUMENTS); void ADMBase_SetShiftStateOff(CCTK_ARGUMENTS); -void ADMBase_SetDtlapseStateOn(CCTK_ARGUMENTS); -void ADMBase_SetDtlapseStateOff(CCTK_ARGUMENTS); -void ADMBase_SetDtshiftStateOn(CCTK_ARGUMENTS); -void ADMBase_SetDtshiftStateOff(CCTK_ARGUMENTS); +void ADMBase_SetDtLapseStateOn(CCTK_ARGUMENTS); +void ADMBase_SetDtLapseStateOff(CCTK_ARGUMENTS); +void ADMBase_SetDtShiftStateOn(CCTK_ARGUMENTS); +void ADMBase_SetDtShiftStateOff(CCTK_ARGUMENTS); /******************************************************************** ********************* Other Routine Prototypes ********************* @@ -254,6 +254,98 @@ void ADMBase_ShiftZero(CCTK_ARGUMENTS) } +/*@@ + @routine ADMBase_DtLapseZero + @date Oct 18 2007 + @author Erik Schnetter + @desc + Scheduled routine to initialise the dtlapse to zero. + @enddesc + @calls + @calledby + @history + + @endhistory + + @@*/ +void ADMBase_DtLapseZero(CCTK_ARGUMENTS) +{ + int i; + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++) + { + dtalp[i] = 0.0; + } + + if (CCTK_ActiveTimeLevels(cctkGH, "ADMBase::dtlapse") > 1) + { + for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++) + { + dtalp_p[i] = 0.0; + } + } + + if (CCTK_ActiveTimeLevels(cctkGH, "ADMBase::dtlapse") > 2) + { + for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++) + { + dtalp_p_p[i] = 0.0; + } + } + +} + +/*@@ + @routine ADMBase_DtShiftZero + @date Oct 18 2007 + @author Erik Schnetter + @desc + Scheduled routine to initialise the dtshift to zero. + @enddesc + @calls + @calledby + @history + + @endhistory + + @@*/ +void ADMBase_DtShiftZero(CCTK_ARGUMENTS) +{ + int i; + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++) + { + dtbetax[i] = 0.0; + dtbetay[i] = 0.0; + dtbetaz[i] = 0.0; + } + + if (CCTK_ActiveTimeLevels(cctkGH, "ADMBase::dtshift") > 1) + { + for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++) + { + dtbetax_p[i] = 0.0; + dtbetay_p[i] = 0.0; + dtbetaz_p[i] = 0.0; + } + } + + if (CCTK_ActiveTimeLevels(cctkGH, "ADMBase::dtshift") > 2) + { + for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++) + { + dtbetax_p_p[i] = 0.0; + dtbetay_p_p[i] = 0.0; + dtbetaz_p_p[i] = 0.0; + } + } + +} + /*@@ @routine ADMBase_DtlapseZero @date Sep 06 2006 @@ -391,8 +483,8 @@ void ADMBase_SetShiftStateOff(CCTK_ARGUMENTS) } /*@@ - @routine ADMBase_SetDtlapseStateOn - @date Sep 06 2006 + @routine ADMBase_SetDtLapseStateOn + @date Oct 18 2007 @author Erik Schnetter @desc Scheduled routine to set the value of the dtlapse state to on. @@ -404,7 +496,7 @@ void ADMBase_SetShiftStateOff(CCTK_ARGUMENTS) @endhistory @@*/ -void ADMBase_SetDtlapseStateOn(CCTK_ARGUMENTS) +void ADMBase_SetDtLapseStateOn(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -413,8 +505,8 @@ void ADMBase_SetDtlapseStateOn(CCTK_ARGUMENTS) } /*@@ - @routine ADMBase_SetDtlapseStateOff - @date Sep 06 2006 + @routine ADMBase_SetDtLapseStateOff + @date Oct 18 2007 @author Erik Schnetter @desc Scheduled routine to set the value of the dtlapse state to off. @@ -426,7 +518,7 @@ void ADMBase_SetDtlapseStateOn(CCTK_ARGUMENTS) @endhistory @@*/ -void ADMBase_SetDtlapseStateOff(CCTK_ARGUMENTS) +void ADMBase_SetDtLapseStateOff(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -435,8 +527,8 @@ void ADMBase_SetDtlapseStateOff(CCTK_ARGUMENTS) } /*@@ - @routine ADMBase_SetDtshiftStateOn - @date Sep 06 2006 + @routine ADMBase_SetDtShiftStateOn + @date Oct 18 2007 @author Erik Schnetter @desc Scheduled routine to set the value of the dtshift state to on. @@ -448,7 +540,7 @@ void ADMBase_SetDtlapseStateOff(CCTK_ARGUMENTS) @endhistory @@*/ -void ADMBase_SetDtshiftStateOn(CCTK_ARGUMENTS) +void ADMBase_SetDtShiftStateOn(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; @@ -457,8 +549,8 @@ void ADMBase_SetDtshiftStateOn(CCTK_ARGUMENTS) } /*@@ - @routine ADMBase_SetDtshiftStateOff - @date Sep 06 2006 + @routine ADMBase_SetDtShiftStateOff + @date Oct 18 2007 @author Erik Schnetter @desc Scheduled routine to set the value of the dtshift state to off. @@ -470,7 +562,7 @@ void ADMBase_SetDtshiftStateOn(CCTK_ARGUMENTS) @endhistory @@*/ -void ADMBase_SetDtshiftStateOff(CCTK_ARGUMENTS) +void ADMBase_SetDtShiftStateOff(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; diff --git a/src/Static.c b/src/Static.c new file mode 100644 index 0000000..59ea223 --- /dev/null +++ b/src/Static.c @@ -0,0 +1,72 @@ +#include + +#include "cctk.h" +#include "cctk_Arguments.h" + +void ADMBase_LapseStatic (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + int npoints; + + if (CCTK_ActiveTimeLevelsGN (cctkGH, "ADMBase::lapse") > 1) + { + npoints = cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; + memcpy (alp, alp_p, npoints * sizeof *alp); + } + + if (CCTK_ActiveTimeLevelsGN (cctkGH, "ADMBase::dtlapse") > 1) + { + npoints = cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; + memcpy (dtalp, dtalp_p, npoints * sizeof *dtalp); + } +} + +void ADMBase_ShiftStatic (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + int npoints; + + if (CCTK_ActiveTimeLevelsGN (cctkGH, "ADMBase::shift") > 1) + { + npoints = cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; + memcpy (betax, betax_p, npoints * sizeof *betax); + memcpy (betay, betay_p, npoints * sizeof *betay); + memcpy (betaz, betaz_p, npoints * sizeof *betaz); + } + + if (CCTK_ActiveTimeLevelsGN (cctkGH, "ADMBase::dtshift") > 1) + { + npoints = cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; + memcpy (dtbetax, dtbetax_p, npoints * sizeof *dtbetax); + memcpy (dtbetay, dtbetay_p, npoints * sizeof *dtbetay); + memcpy (dtbetaz, dtbetaz_p, npoints * sizeof *dtbetaz); + } +} + +void ADMBase_Static (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + int npoints; + + if (CCTK_ActiveTimeLevelsGN (cctkGH, "ADMBase::metric") > 1) + { + npoints = cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; + memcpy (gxx, gxx_p, npoints * sizeof *gxx); + memcpy (gxy, gxy_p, npoints * sizeof *gxy); + memcpy (gxz, gxz_p, npoints * sizeof *gxz); + memcpy (gyy, gyy_p, npoints * sizeof *gyy); + memcpy (gyz, gyz_p, npoints * sizeof *gyz); + memcpy (gzz, gzz_p, npoints * sizeof *gzz); + } + + if (CCTK_ActiveTimeLevelsGN (cctkGH, "ADMBase::curv") > 1) + { + npoints = cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; + memcpy (kxx, kxx_p, npoints * sizeof *kxx); + memcpy (kxy, kxy_p, npoints * sizeof *kxy); + memcpy (kxz, kxz_p, npoints * sizeof *kxz); + memcpy (kyy, kyy_p, npoints * sizeof *kyy); + memcpy (kyz, kyz_p, npoints * sizeof *kyz); + memcpy (kzz, kzz_p, npoints * sizeof *kzz); + } +} diff --git a/src/make.code.defn b/src/make.code.defn index fe350cd..9e589ef 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -2,7 +2,7 @@ # $Header$ # Source files in this directory -SRCS = ParamCheck.c Initialisation.c InitSymBound.c +SRCS = ParamCheck.c Initialisation.c Static.c InitSymBound.c # Subdirectories containing source files SUBDIRS = -- cgit v1.2.3