diff options
-rw-r--r-- | doc/TODO | 1 | ||||
-rw-r--r-- | interface.ccl | 6 | ||||
-rw-r--r-- | param.ccl | 14 | ||||
-rw-r--r-- | schedule.ccl | 29 | ||||
-rw-r--r-- | src/driver/README | 7 | ||||
-rw-r--r-- | src/driver/announce.cc | 104 | ||||
-rw-r--r-- | src/driver/driver.hh | 5 | ||||
-rw-r--r-- | src/driver/make.code.defn | 2 |
8 files changed, 166 insertions, 2 deletions
@@ -1,5 +1,4 @@ small things - set centroid variables for drift correction add an option to compute/output the surface radius on a latitude/longitude grid I should set CXXFLAGS for this thorn to turn off automagic template diff --git a/interface.ccl b/interface.ccl index 8f8055d..0ac8643 100644 --- a/interface.ccl +++ b/interface.ccl @@ -7,4 +7,10 @@ inherits: Grid ADMBase StaticConformal SpaceMask IO always # include file provided by SpaceMask USES INCLUDE: SpaceMask.h +# aliased function maybe provided by DriftCorrect +SUBROUTINE SetDriftCorrectPosition(CCTK_POINTER IN GH, CCTK_REAL IN x, \ + CCTK_REAL IN y, \ + CCTK_REAL IN z) +USES FUNCTION SetDriftCorrectPosition + ################################################################################ @@ -80,6 +80,20 @@ int N_horizons "number of apparent horizons to search for" } 1 # +# This parameter controls whether or not (assuming we have found a +# horizon or horizons), we announce a selected horizon centroid to +# some other thorn. In practice the other thorn will be DriftCorrect, +# which will use this information to adjust the coordinates to try to +# keep the horizon centroid at a constant coordinate position. +# +int which_horizon_to_announce_centroid \ + "for which horizon should we announce the centroid?" +{ +0 :: "don't announce any centroid(s)" +1:10 :: "announce this horizon's centroid each time we find it" +} 0 + +# # This parameter controls how verbose this thorn is in printing # informational (non-error) messages describing what it's doing. # diff --git a/schedule.ccl b/schedule.ccl index 2abf1f6..59d6430 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -16,8 +16,37 @@ if (find_every != 0) triggers: always } "find apparent horizon(s) after this time step" + if (which_horizon_to_announce_centroid != 0) + { + schedule AHFinderDirect_announce at CCTK_ANALYSIS \ + before DriftCorrect \ + after AHFinderDirect_find_horizons + { + lang: C + triggers: always + } "announce horizon position(s) to other thorns" + } + if (set_mask != 0) { + # + # *** KLUDGE *** + # + # We would really like to give this routine the + # options:global + # attribute, so it only runs on those time levels where + # we've found (or at least tried to fnid) horizons. But + # this doesn't work, because we need a GH -- and the other + # thorns' routines we call need valid grid variables in it + # -- in the announcing, and options:global routines don't + # have a "normal" GH, but instead a special one without + # usual grid variables defined in the usual manner. + # + # So, what to do? The present kludge is to have this + # routine called on every grid, then have it explicitly + # test if it's at a horizon-finding time and on a base + # grid. + # schedule AHFinderDirect_do_masks at CCTK_ANALYSIS \ after AHFinderDirect_find_horizons { diff --git a/src/driver/README b/src/driver/README index 334dc9f..a19bbb0 100644 --- a/src/driver/README +++ b/src/driver/README @@ -20,6 +20,13 @@ find_horizons.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS this is called from the scheduler to find the apparent horizon(s) in a slice +announce.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS + this is called from the scheduler to announce apparent horizon + info to other thorns + +mask.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS + this is called from the scheduler to set an excision mask or masks + initial_guess.cc this sets up the initial guess(es) for the horizon position(s) diff --git a/src/driver/announce.cc b/src/driver/announce.cc new file mode 100644 index 0000000..0ea0256 --- /dev/null +++ b/src/driver/announce.cc @@ -0,0 +1,104 @@ +// announce.cc -- annnounce apparent horizon info to other thorns +// $Header$ +// +// <<<access to persistent data>>> +// AHFinderDirect_announce - top-level driver for announce stuff +// + +#include <stdio.h> +#include <assert.h> +#include <math.h> + +#include "util_Table.h" +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +#include "config.h" +#include "stdc.h" +#include "../jtutil/util.hh" +#include "../jtutil/array.hh" +#include "../jtutil/cpm_map.hh" +#include "../jtutil/linear_map.hh" +using jtutil::error_exit; + +#include "../patch/coords.hh" +#include "../patch/grid.hh" +#include "../patch/fd_grid.hh" +#include "../patch/patch.hh" +#include "../patch/patch_edge.hh" +#include "../patch/patch_interp.hh" +#include "../patch/ghost_zone.hh" +#include "../patch/patch_system.hh" + +#include "../elliptic/Jacobian.hh" + +#include "../gr/gfns.hh" +#include "../gr/gr.hh" + +#include "horizon_sequence.hh" +#include "BH_diagnostics.hh" +#include "driver.hh" + +//****************************************************************************** + +// +// ***** access to persistent data ***** +// +extern struct state state; + +//****************************************************************************** + +// +// This function is called by the Cactus scheduler, to announce any +// desired apparent horizon info to any other thorns that may be interested. At present the only info +// we announce is the centroid position of a single selected apparent +// horizon; if the SetAHCentroid() aliased function has been defined +// then we announce by calling that. +// +extern "C" + void AHFinderDirect_announce(CCTK_ARGUMENTS) +{ +DECLARE_CCTK_ARGUMENTS +DECLARE_CCTK_PARAMETERS + +const struct verbose_info& verbose_info = state.verbose_info; + +// only try to announce AH info if we've found AHs at this time level +// ==> only try every find_every time steps +if ((cctk_iteration % find_every) != 0) + then return; // *** NO-OP RETURN *** + +// which horizon to announce? +const int hn = which_horizon_to_announce_centroid; +if (hn == 0) + then return; // *** NO-OP RETURN *** + +if (! ((hn >= 1) && (hn <= N_horizons)) ) + then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING, +"\n" +" AHFinderDirect_announce():\n" +" invalid horizon number %d to announce\n" +" (valid range is [1,N_horizons=%d])!\n" + , + hn, int(N_horizons)); /*NOTREACHED*/ + +// did we actually *find* this horizon? +if (state.AH_data_array[hn] == NULL) + then return; // *** NO-OP RETURN *** + +// is there anyone to announce it to? +if (CCTK_IsFunctionAliased("SetDriftCorrectPosition")) + then { + const struct AH_data& AH_data = *state.AH_data_array[hn]; + const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics; + const CCTK_REAL xx = BH_diagnostics.centroid_x; + const CCTK_REAL yy = BH_diagnostics.centroid_y; + const CCTK_REAL zz = BH_diagnostics.centroid_z; + if (verbose_info.print_physics_details) + then CCTK_VInfo(CCTK_THORNSTRING, + "horizon %d centroid (%g,%g,%g) --> DriftCorrect", + hn, double(xx), double(yy), double(zz)); + SetDriftCorrectPosition(cctkGH, xx, yy, zz); + } +} diff --git a/src/driver/driver.hh b/src/driver/driver.hh index 74fddaa..66015ed 100644 --- a/src/driver/driver.hh +++ b/src/driver/driver.hh @@ -365,6 +365,11 @@ extern "C" extern "C" void AHFinderDirect_find_horizons(CCTK_ARGUMENTS); +// announce.cc +// ... called from Cactus Scheduler +extern "C" + void AHFinderDirect_announce(CCTK_ARGUMENTS); + // mask.cc // ... called from Cactus Scheduler extern "C" diff --git a/src/driver/make.code.defn b/src/driver/make.code.defn index a414f4a..352a0cb 100644 --- a/src/driver/make.code.defn +++ b/src/driver/make.code.defn @@ -6,7 +6,7 @@ SRCS = state.cc \ setup.cc find_horizons.cc \ initial_guess.cc Newton.cc \ io.cc misc-driver.cc \ - mask.cc \ + announce.cc mask.cc \ BH_diagnostics.cc horizon_sequence.cc # Subdirectories containing source files |