diff options
author | rhaas <rhaas@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2013-02-02 05:47:25 +0000 |
---|---|---|
committer | rhaas <rhaas@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2013-02-02 05:47:25 +0000 |
commit | 903123a176b6c10e77fb3e013a35cc48fdcf2d31 (patch) | |
tree | 5bc5fe2093f240114fbe197bd42bff03335930bd /src/driver/Newton.cc | |
parent | da6980d7c376f5e7e77c45ce313994705e5e2cf4 (diff) |
Dont use initial guess origins from parameters when tracking from gridscalar
Problem: My horizon will appear sometimes during the simulation at some position. I don't know this position in advance, so I set origin_* and AHFinderDirect::initial_guesscoord_sphere*_center to zero initially in my par-file. However, I have a grid scalar which tracks the coordinate location where the horizon will eventually appear.
When the horizon finder starts to search for a horizon, it will first setup the
coordinate ellipsoid. This routine is executed *before* the new origin is set
from the grid scalar.
The tracking occurs in the routine Newton(...). The ellipsoid is set before
Newton(...) gets executed. Hence, the ellipsoid uses the value that got set via
parameters (which would be zero in my case).
Patch by Christian Reisswig
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1573 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/driver/Newton.cc')
-rw-r--r-- | src/driver/Newton.cc | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc index 26460d2..44ed611 100644 --- a/src/driver/Newton.cc +++ b/src/driver/Newton.cc @@ -83,6 +83,49 @@ void Newton_step(patch_system& ps, const struct verbose_info& verbose_info); } +void track_origin(const cGH* const cctkGH, patch_system& ps, + struct AH_data* const AH_data_ptr, + const int hn, const bool print_algorithm_highlights); + + +//****************************************************************************** +// +// This function reads a coordinate origin from a grid scalar, +// and sets the patch system's origin to that new value +// +// +void track_origin(const cGH* const cctkGH, patch_system& ps, + struct AH_data* const AH_data_ptr, + const int hn, const bool print_algorithm_highlights) +{ +DECLARE_CCTK_ARGUMENTS; +DECLARE_CCTK_PARAMETERS; + +if (AH_data_ptr->depends_on == 0) { + // move the origin as specified in the grid scalars + fp const * const ox = + static_cast<CCTK_REAL const *> + (CCTK_VarDataPtr (cctkGH, 0, track_origin_source_x[hn])); + assert (ox); + fp const * const oy = + static_cast<CCTK_REAL const *> + (CCTK_VarDataPtr (cctkGH, 0, track_origin_source_y[hn])); + assert (oy); + fp const * const oz = + static_cast<CCTK_REAL const *> + (CCTK_VarDataPtr (cctkGH, 0, track_origin_source_z[hn])); + assert (oz); + if (print_algorithm_highlights) { + std::cout << "AHF tracked position ox " << *ox << " oy " << *oy << " oz " << *oz << std::endl; + } + ps.origin_x (*ox); + ps.origin_y (*oy); + ps.origin_z (*oz); +} + +} + + //****************************************************************************** // @@ -331,27 +374,8 @@ if (hs.has_genuine_horizons()) ps.synchronize(); } } - if (track_origin_from_grid_scalar[hn] && AH_data_ptr->depends_on == 0) { - // move the origin as specified in the grid scalars - fp const * const ox = - static_cast<CCTK_REAL const *> - (CCTK_VarDataPtr (cctkGH, 0, track_origin_source_x[hn])); - assert (ox); - fp const * const oy = - static_cast<CCTK_REAL const *> - (CCTK_VarDataPtr (cctkGH, 0, track_origin_source_y[hn])); - assert (oy); - fp const * const oz = - static_cast<CCTK_REAL const *> - (CCTK_VarDataPtr (cctkGH, 0, track_origin_source_z[hn])); - assert (oz); - if (verbose_info.print_algorithm_highlights) { - std::cout << "AHF tracked position ox " << *ox << " oy " << *oy << " oz " << *oz << std::endl; - } - patch_system& ps = *ps_ptr; - ps.origin_x (*ox); - ps.origin_y (*oy); - ps.origin_z (*oz); + if (track_origin_from_grid_scalar[hn]) { + track_origin(cctkGH, *ps_ptr, AH_data_ptr, hn, verbose_info.print_algorithm_highlights); } // modify the initial guess |