aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--param.ccl15
-rw-r--r--src/driver/driver.hh11
-rw-r--r--src/driver/initial_guess.cc15
-rw-r--r--src/driver/io.cc35
-rw-r--r--src/driver/setup.cc3
5 files changed, 64 insertions, 15 deletions
diff --git a/param.ccl b/param.ccl
index 70c1242..8e16bfe 100644
--- a/param.ccl
+++ b/param.ccl
@@ -122,19 +122,28 @@ boolean print_timing_stats \
# next attempting to find this horizon.)
#
-# n.b. Schwarzschild/EF is the special case spin=0 of Kerr/Kerr
keyword initial_guess_method[5] \
"method used to set up initial guess for apparent horizon shape"
{
-"read from file" :: "read from input file"
+"read from named file" :: "read from explicitly-named input file"
+"read from h file" :: \
+ "read from input file named the same as the (later) h output file"
"Kerr/Kerr" :: \
- "set to the (analytical) horizon of Kerr spacetime in Kerr coordinates"
+ "set to the (analytical) horizon of Kerr spacetime in Kerr coordinates \
+ (n.b. Schwarzschild/EF is the special case spin=0 of this)"
"Kerr/Kerr-Schild" :: \
"set to the (analytical) horizon of Kerr spacetime in Kerr-Schild coordinates"
"coordinate sphere" :: "set to a coordinate sphere"
"coordinate ellipsoid" :: "set to a coordinate ellipsoid"
} "coordinate sphere"
+# parameters for initial_guess_method = "read from named file"
+string initial_guess__read_from_named_file__file_name[5] \
+ "file name to read initial guess from"
+{
+.+ :: "file name to read initial guess from"
+} "h.gp"
+
# parameters for initial_guess_method = "Kerr/Kerr"
real initial_guess__Kerr_Kerr__x_posn[5] "x coordinate of Kerr BH"
{
diff --git a/src/driver/driver.hh b/src/driver/driver.hh
index 4511208..c9961c4 100644
--- a/src/driver/driver.hh
+++ b/src/driver/driver.hh
@@ -44,7 +44,8 @@ enum verbose_level
//
enum initial_guess_method
{
- initial_guess__read_from_file,
+ initial_guess__read_from_named_file,
+ initial_guess__read_from_h_file,
initial_guess__Kerr_Kerr,
initial_guess__Kerr_KerrSchild,
initial_guess__coord_sphere,
@@ -72,6 +73,11 @@ struct initial_guess_info
{
enum initial_guess_method method;
+ // parameters for method == initial_guess__read_from_named_file
+ struct {
+ const char* file_name;
+ } read_from_named_file_info;
+
// parameters for method == initial_guess__Kerr_Kerr
struct {
fp x_posn, y_posn, z_posn;
@@ -360,6 +366,9 @@ void Newton(const cGH* GH,
void input_gridfn(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info, const char base_file_name[],
int hn, bool print_msg_flag, int AHF_iteration = 0);
+void input_gridfn__explicit_name(patch_system& ps, int unknown_gfn,
+ const struct IO_info& IO_info,
+ const char file_name[], bool print_msg_flag);
void output_gridfn(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info, const char base_file_name[],
int hn, bool print_msg_flag, int AHF_iteration = 0);
diff --git a/src/driver/initial_guess.cc b/src/driver/initial_guess.cc
index 9f563dd..6eecd05 100644
--- a/src/driver/initial_guess.cc
+++ b/src/driver/initial_guess.cc
@@ -82,7 +82,14 @@ if (verbose_info.print_algorithm_highlights)
switch (igi.method)
{
-case initial_guess__read_from_file:
+case initial_guess__read_from_named_file:
+ input_gridfn__explicit_name(ps, gfns::gfn__h,
+ IO_info,
+ igi.read_from_named_file_info.file_name,
+ verbose_info.print_algorithm_highlights);
+ break;
+
+case initial_guess__read_from_h_file:
input_gridfn(ps, gfns::gfn__h,
IO_info, IO_info.h_base_file_name,
hn, verbose_info.print_algorithm_highlights);
@@ -148,8 +155,10 @@ default:
enum initial_guess_method
decode_initial_guess_method(const char initial_guess_method_string[])
{
-if (STRING_EQUAL(initial_guess_method_string, "read from file"))
- then return initial_guess__read_from_file;
+if (STRING_EQUAL(initial_guess_method_string, "read from named file"))
+ then return initial_guess__read_from_named_file;
+else if (STRING_EQUAL(initial_guess_method_string, "read from h file"))
+ then return initial_guess__read_from_h_file;
else if (STRING_EQUAL(initial_guess_method_string, "Kerr/Kerr"))
then return initial_guess__Kerr_Kerr;
else if (STRING_EQUAL(initial_guess_method_string, "Kerr/Kerr-Schild"))
diff --git a/src/driver/io.cc b/src/driver/io.cc
index 2a68725..82fc532 100644
--- a/src/driver/io.cc
+++ b/src/driver/io.cc
@@ -2,6 +2,7 @@
// $Header$
//
// input_gridfn - read an angular grid function from an input file
+// input_gridfn__explicit_name - ... with the input file explicitly named
// output_gridfn - write an angular grid function to an output file
// output_Jacobians - write a Jacobian matrix or matrices to an output file
//
@@ -59,7 +60,8 @@ const char* io_file_name(const struct IO_info& IO_info,
//******************************************************************************
//
-// This function inputs a gridfn from a data file.
+// This function inputs a gridfn from a data file, with the file name
+// chosen automagically.
//
// We assume that this gridfn is ghosted, but the ghost zones are *not*
// present in the data file.
@@ -70,14 +72,29 @@ void input_gridfn(patch_system& ps, int unknown_gfn,
{
const char* file_name = io_file_name(IO_info, base_file_name,
hn, AHF_iteration);
+
+input_gridfn__explicit_name(ps, unknown_gfn,
+ IO_info, base_file_name, print_msg_flag);
+}
+
+//******************************************************************************
+
+//
+// This function inputs a gridfn from a data file, with the file name
+// specified explicitly.
+//
+// We assume that this gridfn is ghosted, but the ghost zones are *not*
+// present in the data file.
+//
+void input_gridfn__explicit_name(patch_system& ps, int unknown_gfn,
+ const struct IO_info& IO_info,
+ const char file_name[], bool print_msg_flag)
+{
if (print_msg_flag)
then {
- if ( (unknown_gfn == gfns::gfn__h)
- && (IO_info.time_iteration == 0) && (AHF_iteration == 0) )
+ if (unknown_gfn == gfns::gfn__h)
then CCTK_VInfo(CCTK_THORNSTRING,
" reading initial guess from \"%s\"", file_name);
- else CCTK_VInfo(CCTK_THORNSTRING,
- " reading \"%s\"", file_name);
}
switch (IO_info.horizon_file_format)
@@ -90,13 +107,15 @@ case horizon_file_format__ASCII_gnuplot:
case horizon_file_format__HDF5:
CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"input_gridfn(): HDF5 data files not implemented yet!"); /*NOTREACHED*/
+"input_gridfn__explicit_name(): HDF5 data files not implemented yet!");
+ /*NOTREACHED*/
default:
CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
"\n"
-" input_gridfn(): unknown IO_info.horizon_file_format=(int)%d!\n"
-" (this should never happen!)"
+" input_gridfn__explicit_name():\n"
+" unknown IO_info.horizon_file_format=(int)%d!\n"
+" (this should never happen!)"
,
int(IO_info.horizon_file_format)); /*NOTREACHED*/
}
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index af97e9a..6ed80c6 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -496,6 +496,9 @@ if (strlen(surface_interpolator_name) > 0)
" setting initial guess parameters etc");
AH_data.initial_guess_info.method
= decode_initial_guess_method(initial_guess_method[hn]);
+ // ... read from named file
+ AH_data.initial_guess_info.read_from_named_file_info.file_name
+ = initial_guess__read_from_named_file__file_name[hn];
// ... Kerr/Kerr
AH_data.initial_guess_info.Kerr_Kerr_info.x_posn
= initial_guess__Kerr_Kerr__x_posn[hn];