aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--param.ccl31
-rw-r--r--src/driver/setup.cc15
-rw-r--r--src/gr/expansion.cc66
-rw-r--r--src/gr/gr.hh38
-rw-r--r--src/gr/misc-gr.cc52
5 files changed, 45 insertions, 157 deletions
diff --git a/param.ccl b/param.ccl
index eb894fe..c9857fa 100644
--- a/param.ccl
+++ b/param.ccl
@@ -944,22 +944,10 @@ boolean test_all_Jacobian_compute_methods \
# ***** (gij, Kij, partial_k gij) *****
#
-keyword geometry_method "how do we compute the slice's geometry?"
-{
-# this is for normal use
-"interpolate from Cactus grid" :: \
- "interpolate gij and Kij from global Cactus grid \
- using CCTK_InterpGridArrays() global interpolator API"
-
-# for testing/debugging
-"Schwarzschild/EF" :: \
- "hard-wire to Schwarzschild spacetime / Eddington-Finkelstein slice"
-} "globally interpolate from Cactus grid"
-
########################################
#
-# parameters for geometry_method = "interpolate from Cactus grid"
+# parameters for geometry interpolation
#
# This 3D interpolator is used to interpolate gij and Kij from the
# Cactus grid to the position of each trial horizon surface, giving
@@ -1006,8 +994,15 @@ string geometry_interpolator_pars \
########################################
#
-# parameters for geometry_method = "Schwarzschild/EF"
+# for testing/debugging purposes, instead of interpolating the geometry
+# from the Cactus grid, we can instead hardwire it to an Eddington-Finkelstein
+# slice of Schwarzschild spacetime
#
+boolean hardwire_Schwarzschild_EF_geometry \
+ "should we hard-wire the geometry to Schwarzschild/EF instead of \
+ interpolating from the Cactus grid?"
+{
+} "false"
real geometry__Schwarzschild_EF__mass "mass of Schwarzschild BH"
{
@@ -1027,9 +1022,9 @@ real geometry__Schwarzschild_EF__z_posn "z coordinate of Schwarzschild BH"
*:* :: "any real number"
} 0.0
-# some of the formulas have 0/0 limits on the z axis; this parameter controls
-# where we switch from the generic formulas to the L'Hopital's-rule z axis
-# limits
+# some of the Schwarzschild/EF formulas have 0/0 limits on the z axis;
+# this parameter controls where we switch from the generic formulas to
+# the L'Hopital's-rule z axis limits
# - don't set this parameter too small or roundoff errors will be excessive
# - don't set this parameter too large or finite differencing errors will
# be excessive
@@ -1058,7 +1053,7 @@ real geometry__Schwarzschild_EF__Delta_xyz \
########################################
#
-# These tests control whether we check that various angular gridfns
+# These parameters control whether we check that various angular gridfns
# are finite (neither NaN nor infinity) at various points in evaluating
# the Theta(h) function. These are pretty cheap tests, and they're quite
# useful in catching assorted wierdness, so it's probably worth leaving
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index 5f60afa..78de556 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -157,6 +157,11 @@ if (verbose_info.print_algorithm_highlights)
then CCTK_VInfo(CCTK_THORNSTRING, " setting up Cactus grid info");
struct cactus_grid_info& cgi = state.cgi;
cgi.GH = cctkGH;
+cgi.coord_system_handle = CCTK_CoordSystemHandle(coordinate_system_name);
+if (cgi.coord_system_handle < 0)
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"AHFinderDirect_setup(): can't find Cactus coordinate system \"%s\"!",
+ coordinate_system_name); /*NOTREACHED*/
cgi.use_Cactus_conformal_metric = false; // dummy value, may change later
// get global/local Cactus grid origin
@@ -194,11 +199,6 @@ printf("### cctk_lsh[] = [%d,%d,%d]\n",
int(cctk_lsh[Z_AXIS]));
#endif // DEBUG_COORDS
-cgi.coord_system_handle = CCTK_CoordSystemHandle(coordinate_system_name);
-if (cgi.coord_system_handle < 0)
- then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"AHFinderDirect_setup(): can't find Cactus coordinate system \"%s\"!",
- coordinate_system_name); /*NOTREACHED*/
cgi.g_dd_11_varindex = Cactus_gridfn_varindex("ADMBase::gxx");
cgi.g_dd_12_varindex = Cactus_gridfn_varindex("ADMBase::gxy");
cgi.g_dd_13_varindex = Cactus_gridfn_varindex("ADMBase::gxz");
@@ -220,9 +220,9 @@ cgi.psi_varindex = Cactus_gridfn_varindex("StaticConformal::psi");
if (verbose_info.print_algorithm_highlights)
then CCTK_VInfo(CCTK_THORNSTRING, " setting up geometry interpolator");
struct geometry_info& gi = state.gi;
-gi.geometry_method = decode_geometry_method(geometry_method);
+gi.hardwire_Schwarzschild_EF_geometry
+ = (hardwire_Schwarzschild_EF_geometry != 0);
-// parameters for geometry_method = interpolation methods
gi.operator_handle = CCTK_InterpHandle(geometry_interpolator_name);
if (gi.operator_handle < 0)
then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
@@ -234,7 +234,6 @@ if (gi.param_table_handle < 0)
"AHFinderDirect_setup(): bad geometry-interpolator parameter(s) \"%s\"!",
geometry_interpolator_pars); /*NOTREACHED*/
-// parameters for geometry_method = "Schwarzschild/EF"
gi.geometry__Schwarzschild_EF__mass = geometry__Schwarzschild_EF__mass;
gi.geometry__Schwarzschild_EF__x_posn = geometry__Schwarzschild_EF__x_posn;
gi.geometry__Schwarzschild_EF__y_posn = geometry__Schwarzschild_EF__y_posn;
diff --git a/src/gr/expansion.cc b/src/gr/expansion.cc
index 7ddf6ee..3c25aad 100644
--- a/src/gr/expansion.cc
+++ b/src/gr/expansion.cc
@@ -203,50 +203,26 @@ if (active_flag)
}
// compute the "geometry" g_ij, K_ij, and partial_k g_ij
-switch (gi.geometry_method)
- {
-case geometry__global_interp_from_Cactus_grid:
-case geometry__local_interp_from_Cactus_grid:
+if (gi.hardwire_Schwarzschild_EF_geometry)
+ then {
+ if (active_flag)
+ then Schwarzschild_EF_geometry(*ps_ptr,
+ gi,
+ print_msg_flag);
+ }
+ else {
// this is the only function we call unconditionally; it looks at
// ps_ptr (non-NULL vs NULL) to choose a normal vs dummy computation
- {
- #ifdef GEOMETRY_INTERP_DEBUG
- printf("AHFinderDirect:: proc %d: about to call interpolate_geometry()\n",
- int(CCTK_MyProc(cgi.GH)));
- fflush(stdout);
- #endif
- const
- enum expansion_status status
- = interpolate_geometry(ps_ptr,
- cgi, gi,
- error_info, initial_flag,
- print_msg_flag);
- #ifdef GEOMETRY_INTERP_DEBUG
- printf("AHFinderDirect:: proc %d: interpolate_geometry() status=(int)%d\n",
- int(CCTK_MyProc(cgi.GH)), int(status));
- fflush(stdout);
- #endif
+ const enum expansion_status status
+ = interpolate_geometry(ps_ptr,
+ cgi, gi,
+ error_info, initial_flag,
+ print_msg_flag);
if (status != expansion_success)
then return status; // *** ERROR RETURN ***
- }
if (active_flag && cgi.use_Cactus_conformal_metric)
then convert_conformal_to_physical(*ps_ptr,
print_msg_flag);
- break;
-
-case geometry__Schwarzschild_EF:
- if (active_flag)
- then Schwarzschild_EF_geometry(*ps_ptr,
- gi,
- print_msg_flag);
- break;
-
-default:
- error_exit(PANIC_EXIT,
-"***** expansion(): unknown gi.geometry_method=(int)%d!\n"
-" (this should never happen!)\n"
- ,
- int(gi.geometry_method)); /*NOTREACHED*/
}
if (active_flag)
@@ -381,6 +357,7 @@ enum expansion_status
bool print_msg_flag)
{
const bool active_flag = (ps_ptr != NULL);
+const bool psi_flag = cgi.use_Cactus_conformal_metric;
//
// Implementation Notes:
@@ -395,16 +372,9 @@ const bool active_flag = (ps_ptr != NULL);
// if this is our first call).
//
-const char* const global_local_str
- = (gi.geometry_method == geometry__global_interp_from_Cactus_grid)
- ? "global"
- : "local";
-const bool psi_flag = cgi.use_Cactus_conformal_metric;
-
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING,
- " %s-interpolating %s from Cactus grid",
- global_local_str,
+ " interpolating %s from Cactus grid",
(psi_flag ? "{g_ij, K_ij, psi}" : "{g_ij, K_ij}"));
int status;
@@ -626,8 +596,7 @@ if (par_table_setup && (psi_flag == par_table_psi_flag))
//
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING,
- " calling %s interpolator (%s%d points)",
- global_local_str,
+ " calling geometry interpolator (%s%d points)",
(active_flag ? "" : "dummy: "), N_interp_points);
#ifdef GEOMETRY_INTERP_DEBUG
@@ -647,7 +616,7 @@ printf("AHFinderDirect:: proc %d: initializing interpolator outputs to 999.999\n
#endif
#ifdef GEOMETRY_INTERP_DEBUG
-printf("AHFinderDirect:: proc %d: calling global interpolator (N_interp_points=%d)\n",
+printf("AHFinderDirect:: proc %d: calling CCTK_InterpGridArrays(N_interp_points=%d)\n",
int(CCTK_MyProc(cgi.GH)), N_interp_points);
fflush(stdout);
#endif
@@ -655,7 +624,6 @@ fflush(stdout);
#ifdef GEOMETRY_INTERP_SYNC_SLEEP
sleep(1);
#endif
-
#ifdef GEOMETRY_INTERP_SYNC_BARRIER
CCTK_Barrier(cgi.GH);
#endif
diff --git a/src/gr/gr.hh b/src/gr/gr.hh
index a31148f..9fb02fb 100644
--- a/src/gr/gr.hh
+++ b/src/gr/gr.hh
@@ -10,17 +10,6 @@
enum { N_GRID_DIMS = 3, N_HORIZON_DIMS = 2 };
//
-// this enum holds the (a) decoded geometry_method parameter,
-// i.e. it specifies how we compute the (a) geometry
-//
-enum geometry_method
- {
- geometry__global_interp_from_Cactus_grid,
- geometry__local_interp_from_Cactus_grid,
- geometry__Schwarzschild_EF // no comma
- };
-
-//
// this enum holds the (a) decoded Jacobian_compute_method parameter,
// i.e. it specifies how we compute the (a) Jacobian matrix
//
@@ -74,6 +63,7 @@ enum expansion_status
struct cactus_grid_info
{
cGH *GH; // --> Cactus grid hierarchy
+ int coord_system_handle; // Cactus coordinate system handle
// this describes the semantics of the Cactus gij gridfns:
// true ==> the Cactus g_ij are conformal values as per
@@ -115,16 +105,7 @@ struct cactus_grid_info
int ijk_ceil_of_global_xyz (int axis, fp xyz) const
{ return jtutil::iceil(fp_ijk_of_global_xyz(axis, xyz)); }
- //
- // stuff for doing a global interpolation via CCTK_InterpGridArrays()
- // i.e. geometry_info.geometry_method
- // == geometry__global_interp_from_Cactus_grid
- //
-
- // Cactus coordinate system
- int coord_system_handle;
-
- // Cactus variable indices
+ // Cactus variable indices of geometry variables
int g_dd_11_varindex, g_dd_12_varindex, g_dd_13_varindex,
g_dd_22_varindex, g_dd_23_varindex,
g_dd_33_varindex;
@@ -142,14 +123,16 @@ struct cactus_grid_info
//
struct geometry_info
{
- enum geometry_method geometry_method;
+ // normally false; true for testing/debugging
+ bool hardwire_Schwarzschild_EF_geometry;
- // parameters for geometry_method = interpolate_from_Cactus_grid
+ // parameters for the normal case
+ // hardwire_Schwarzschild_EF_geometry == false
int operator_handle; // Cactus handle to interpolation op
int param_table_handle; // Cactus handle to parameter table
// for the interpolator
- // parameters for geometry_method = Schwarzschild_EF
+ // parameters for hardwire_Schwarzschild_EF_geometry == true
fp geometry__Schwarzschild_EF__x_posn; // x posn of Schwarzschild BH
fp geometry__Schwarzschild_EF__y_posn; // y posn of Schwarzschild BH
fp geometry__Schwarzschild_EF__z_posn; // z posn of Schwarzschild BH
@@ -239,12 +222,7 @@ void Schwarzschild_EF_geometry(patch_system& ps,
const struct geometry_info& gi,
bool msg_flag);
-// misc.cc
-enum geometry_method
- decode_geometry_method(const char geometry_method_string[]);
-#ifdef NOT_USED
-bool geometry_method_is_interp(enum geometry_method geometry_method);
-#endif
+// misc-gr.cc
enum Jacobian_compute_method
decode_Jacobian_compute_method(const char Jacobian_compute_method_string[]);
const char* expansion_status_string(enum expansion_status status);
diff --git a/src/gr/misc-gr.cc b/src/gr/misc-gr.cc
index 9ca3d1f..cc9988f 100644
--- a/src/gr/misc-gr.cc
+++ b/src/gr/misc-gr.cc
@@ -1,11 +1,6 @@
// misc-gr.cc -- misc support routines
// $Header$
//
-// decode_geometry_method - decode the geometry_method parameter
-#ifdef NOT_USED
-// geomery_method_is_interp - does enum geometry_method specify interpolation?
-#endif
-// decode_geometry_method - decode the geometry_method parameter
// expansion_status_string - string describing expansion_status
//
@@ -42,53 +37,6 @@
//******************************************************************************
//
-// This function decodes the geometry_method parameter (string) into
-// an internal enum for future use.
-//
-enum geometry_method
- decode_geometry_method(const char geometry_method_string[])
-{
-if (STRING_EQUAL(geometry_method_string,
- "globally interpolate from Cactus grid"))
- then return geometry__global_interp_from_Cactus_grid;
-else if (STRING_EQUAL(geometry_method_string,
- "locally interpolate from Cactus grid"))
- then return geometry__local_interp_from_Cactus_grid;
-else if (STRING_EQUAL(geometry_method_string,
- "Schwarzschild/EF"))
- then return geometry__Schwarzschild_EF;
-else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"decode_geometry_method(): unknown geometry_method_string=\"%s\"!",
- geometry_method_string); /*NOTREACHED*/
-}
-
-//******************************************************************************
-
-#ifdef NOT_USED
-//
-// This function determines whether or not an enum geometry_method
-// value specifies an interpolation.
-//
-bool geometry_method_is_interp(enum geometry_method geometry_method)
-{
-switch (geometry_method)
- {
-case geometry__global_interp_from_Cactus_grid:
-case geometry__local_interp_from_Cactus_grid:
- return true;
-case geometry__Schwarzschild_EF:
- return false;
-default:
- CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"geometry_method_is_interp(): unknown geometry_method=(int)%d!",
- geometry_method); /*NOTREACHED*/
- }
-}
-#endif
-
-//******************************************************************************
-
-//
// This function decodes the Jacobian_compute_method parameter (string) into
// an internal enum for future use.
//