From d7b7bd33b9234a36e1899c008a6f6416a00cc98a Mon Sep 17 00:00:00 2001 From: baiotti Date: Thu, 23 Mar 2006 16:54:51 +0000 Subject: The carpet patch timed Sat Mar 4 18:38:10 CET 2006, not allowing any longer the use of CCTK_DELTA_SPACE in global mode, had broken our way of computing volume integrals. Here is the upgrade. Further changes are the transformation of divisions into moltiplications and the boundary corrections in the computation of the integral when PUGH is used. This last part is not tested (but will be), anyway who uses PUGH nowadays? git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/ADMMass/trunk@9 54511f98-0e4f-0410-826e-eb8b393f5a1e --- interface.ccl | 2 + schedule.ccl | 10 ++- src/surface_integral.c | 72 +++++++++-------- src/volume_integral.c | 211 ++++++++++++++++++++++++++++++++----------------- 4 files changed, 188 insertions(+), 107 deletions(-) diff --git a/interface.ccl b/interface.ccl index c71e1f8..384c54d 100644 --- a/interface.ccl +++ b/interface.ccl @@ -47,3 +47,5 @@ CCTK_REAL ADMMass_box type = scalar tags='checkpoint="no"' ADMMass_box_z_min ADMMass_box_z_max } "Physical coordinates of the surface on which the integral is computed" + +real grid_spacing_product type=SCALAR tags='checkpoint="no"' "product of cctk_delta_space, to be computed in local mode and later used in global mode (carpet problems)" diff --git a/schedule.ccl b/schedule.ccl index 42ebdd0..fc54cb1 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -22,11 +22,19 @@ schedule ADMMass_Loop IN ADMMass BEFORE ADMMass_Local OPTIONS: global } "Decrement loop counter" - +######################################################################################### +# We must schedule the local routines to compute the integrals in global-loop-local +# (as opposed to local) mode, in order to make sure that the scheduling condition +# "AFTER", which describes the ADMMass group, is respected. This group may depend +# on local routines (excision, emask) and must be run after all local routines. +# If we had no such a dependence, we could have scheduled the integral computations +# simply in local mode. +########################################################################################## schedule GROUP ADMMass AT POSTSTEP AFTER ADMMass_InitLoopCounter WHILE ADMMass::ADMMass_LoopCounter { STORAGE:ADMMass_GFs[3] STORAGE:ADMMass_box + STORAGE:grid_spacing_product } "ADMMass loop" schedule ADMMass_Surface IN ADMMass diff --git a/src/surface_integral.c b/src/surface_integral.c index fad504b..b8a3998 100644 --- a/src/surface_integral.c +++ b/src/surface_integral.c @@ -43,9 +43,9 @@ void ADMMass_Surface(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_PARAMETERS - CCTK_INT i,j,k, ijk, ierr, ghost; + CCTK_INT i,j,k, ijk, ierr, ghost, ti, tj, tk, tl; CCTK_INT x_min_i, x_max_i, y_min_j, y_max_j, z_min_k, z_max_k; - CCTK_REAL detg, idetg, oneDX, oneDY, oneDZ, twoDX, twoDY, twoDZ, ds[3]; + CCTK_REAL detg, idetg, ds[3]; CCTK_REAL u[3][3], dg[3][3][3]; CCTK_REAL physical_min[3]; @@ -58,18 +58,22 @@ void ADMMass_Surface(CCTK_ARGUMENTS) char coordinate_parameter_type[9]; +#include "CactusEinstein/ADMMacros/src/macro/UPPERMET_declare.h" + /* grid-function strides for ADMMacros */ const CCTK_INT di = 1; const CCTK_INT dj = cctk_lsh[0]; const CCTK_INT dk = cctk_lsh[0]*cctk_lsh[1]; /* deonminators for derivatives */ - twoDX = 2.0 * CCTK_DELTA_SPACE(0); - twoDY = 2.0 * CCTK_DELTA_SPACE(1); - twoDZ = 2.0 * CCTK_DELTA_SPACE(2); - oneDX = CCTK_DELTA_SPACE(0); - oneDY = CCTK_DELTA_SPACE(1); - oneDZ = CCTK_DELTA_SPACE(2); + const CCTK_REAL OneOverTwoDX = 1.0 / (2.0 * CCTK_DELTA_SPACE(0)); + const CCTK_REAL OneOverTwoDY = 1.0 / (2.0 * CCTK_DELTA_SPACE(1)); + const CCTK_REAL OneOverTwoDZ = 1.0 / (2.0 * CCTK_DELTA_SPACE(2)); + + const CCTK_REAL oneDX = CCTK_DELTA_SPACE(0); + const CCTK_REAL oneDY = CCTK_DELTA_SPACE(1); + const CCTK_REAL oneDZ = CCTK_DELTA_SPACE(2); + x_min_i = -INT_MAX; x_max_i = INT_MAX; @@ -156,8 +160,6 @@ void ADMMass_Surface(CCTK_ARGUMENTS) if ( (z[0] < *ADMMass_box_z_max) && (*ADMMass_box_z_max < z[ijk]) ) z_max_k = find_closest(cctkGH, cctk_lsh, cctk_delta_space, ghost, z, *ADMMass_box_z_max, 2); -#include "CactusEinstein/ADMMacros/src/macro/UPPERMET_declare.h" - for(i=ghost; i