diff options
Diffstat (limited to 'ML_BSSN/src/ML_BSSN_boundary.cc')
-rw-r--r-- | ML_BSSN/src/ML_BSSN_boundary.cc | 195 |
1 files changed, 53 insertions, 142 deletions
diff --git a/ML_BSSN/src/ML_BSSN_boundary.cc b/ML_BSSN/src/ML_BSSN_boundary.cc index af2287a..140da41 100644 --- a/ML_BSSN/src/ML_BSSN_boundary.cc +++ b/ML_BSSN/src/ML_BSSN_boundary.cc @@ -12,6 +12,7 @@ #include "cctk_Parameters.h" #include "GenericFD.h" #include "Differencing.h" +#include "cctk_Loop.h" #include "loopcontrol.h" #include "vectors.h" @@ -64,8 +65,6 @@ static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const d DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -102,9 +101,9 @@ static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const d CCTK_REAL_VEC const p1o12dx = kmul(INV(dx),ToReal(0.0833333333333333333333333333333)); CCTK_REAL_VEC const p1o12dy = kmul(INV(dy),ToReal(0.0833333333333333333333333333333)); CCTK_REAL_VEC const p1o12dz = kmul(INV(dz),ToReal(0.0833333333333333333333333333333)); - CCTK_REAL_VEC const p1o144dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(0.00694444444444444444444444444444))); - CCTK_REAL_VEC const p1o144dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(0.00694444444444444444444444444444))); - CCTK_REAL_VEC const p1o144dydz = kmul(INV(dy),kmul(INV(dz),ToReal(0.00694444444444444444444444444444))); + CCTK_REAL_VEC const p1o144dxdy = kmul(INV(kmul(dx,dy)),ToReal(0.00694444444444444444444444444444)); + CCTK_REAL_VEC const p1o144dxdz = kmul(INV(kmul(dx,dz)),ToReal(0.00694444444444444444444444444444)); + CCTK_REAL_VEC const p1o144dydz = kmul(INV(kmul(dy,dz)),ToReal(0.00694444444444444444444444444444)); CCTK_REAL_VEC const p1o1680dx = kmul(INV(dx),ToReal(0.000595238095238095238095238095238)); CCTK_REAL_VEC const p1o1680dy = kmul(INV(dy),ToReal(0.000595238095238095238095238095238)); CCTK_REAL_VEC const p1o1680dz = kmul(INV(dz),ToReal(0.000595238095238095238095238095238)); @@ -123,14 +122,14 @@ static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const d CCTK_REAL_VEC const p1o2dx = kmul(INV(dx),ToReal(0.5)); CCTK_REAL_VEC const p1o2dy = kmul(INV(dy),ToReal(0.5)); CCTK_REAL_VEC const p1o2dz = kmul(INV(dz),ToReal(0.5)); - CCTK_REAL_VEC const p1o3600dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(0.000277777777777777777777777777778))); - CCTK_REAL_VEC const p1o3600dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(0.000277777777777777777777777777778))); - CCTK_REAL_VEC const p1o3600dydz = kmul(INV(dy),kmul(INV(dz),ToReal(0.000277777777777777777777777777778))); + CCTK_REAL_VEC const p1o3600dxdy = kmul(INV(kmul(dx,dy)),ToReal(0.000277777777777777777777777777778)); + CCTK_REAL_VEC const p1o3600dxdz = kmul(INV(kmul(dx,dz)),ToReal(0.000277777777777777777777777777778)); + CCTK_REAL_VEC const p1o3600dydz = kmul(INV(kmul(dy,dz)),ToReal(0.000277777777777777777777777777778)); CCTK_REAL_VEC const p1o4dx = kmul(INV(dx),ToReal(0.25)); - CCTK_REAL_VEC const p1o4dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(0.25))); - CCTK_REAL_VEC const p1o4dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(0.25))); + CCTK_REAL_VEC const p1o4dxdy = kmul(INV(kmul(dx,dy)),ToReal(0.25)); + CCTK_REAL_VEC const p1o4dxdz = kmul(INV(kmul(dx,dz)),ToReal(0.25)); CCTK_REAL_VEC const p1o4dy = kmul(INV(dy),ToReal(0.25)); - CCTK_REAL_VEC const p1o4dydz = kmul(INV(dy),kmul(INV(dz),ToReal(0.25))); + CCTK_REAL_VEC const p1o4dydz = kmul(INV(kmul(dy,dz)),ToReal(0.25)); CCTK_REAL_VEC const p1o4dz = kmul(INV(dz),ToReal(0.25)); CCTK_REAL_VEC const p1o5040dx2 = kmul(INV(SQR(dx)),ToReal(0.000198412698412698412698412698413)); CCTK_REAL_VEC const p1o5040dy2 = kmul(INV(SQR(dy)),ToReal(0.000198412698412698412698412698413)); @@ -144,9 +143,9 @@ static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const d CCTK_REAL_VEC const p1o64dx = kmul(INV(dx),ToReal(0.015625)); CCTK_REAL_VEC const p1o64dy = kmul(INV(dy),ToReal(0.015625)); CCTK_REAL_VEC const p1o64dz = kmul(INV(dz),ToReal(0.015625)); - CCTK_REAL_VEC const p1o705600dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(1.41723356009070294784580498866e-6))); - CCTK_REAL_VEC const p1o705600dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(1.41723356009070294784580498866e-6))); - CCTK_REAL_VEC const p1o705600dydz = kmul(INV(dy),kmul(INV(dz),ToReal(1.41723356009070294784580498866e-6))); + CCTK_REAL_VEC const p1o705600dxdy = kmul(INV(kmul(dx,dy)),ToReal(1.41723356009070294784580498866e-6)); + CCTK_REAL_VEC const p1o705600dxdz = kmul(INV(kmul(dx,dz)),ToReal(1.41723356009070294784580498866e-6)); + CCTK_REAL_VEC const p1o705600dydz = kmul(INV(kmul(dy,dz)),ToReal(1.41723356009070294784580498866e-6)); CCTK_REAL_VEC const p1o840dx = kmul(INV(dx),ToReal(0.00119047619047619047619047619048)); CCTK_REAL_VEC const p1o840dy = kmul(INV(dy),ToReal(0.00119047619047619047619047619048)); CCTK_REAL_VEC const p1o840dz = kmul(INV(dz),ToReal(0.00119047619047619047619047619048)); @@ -227,7 +226,7 @@ static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const d /* Loop over the grid points */ #pragma omp parallel - LC_LOOP3VEC (ML_BSSN_boundary, + LC_LOOP3VEC(ML_BSSN_boundary, i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], cctk_lsh[0],cctk_lsh[1],cctk_lsh[2], CCTK_REAL_VEC_SIZE) @@ -309,132 +308,35 @@ static void ML_BSSN_boundary_Body(cGH const * restrict const cctkGH, int const d CCTK_REAL_VEC B3L = ToReal(0); - /* If necessary, store only partial vectors after the first iteration */ - - if (CCTK_REAL_VEC_SIZE > 2 && CCTK_BUILTIN_EXPECT(i < lc_imin && i+CCTK_REAL_VEC_SIZE > lc_imax, 0)) - { - ptrdiff_t const elt_count_lo = lc_imin-i; - ptrdiff_t const elt_count_hi = lc_imax-i; - vec_store_nta_partial_mid(A[index],AL,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(alpha[index],alphaL,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(At11[index],At11L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(At12[index],At12L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(At13[index],At13L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(At22[index],At22L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(At23[index],At23L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(At33[index],At33L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(B1[index],B1L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(B2[index],B2L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(B3[index],B3L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(beta1[index],beta1L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(beta2[index],beta2L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(beta3[index],beta3L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(gt11[index],gt11L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(gt12[index],gt12L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(gt13[index],gt13L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(gt22[index],gt22L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(gt23[index],gt23L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(gt33[index],gt33L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(phi[index],phiL,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(trK[index],trKL,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(Xt1[index],Xt1L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(Xt2[index],Xt2L,elt_count_lo,elt_count_hi); - vec_store_nta_partial_mid(Xt3[index],Xt3L,elt_count_lo,elt_count_hi); - break; - } - - /* If necessary, store only partial vectors after the first iteration */ - - if (CCTK_REAL_VEC_SIZE > 1 && CCTK_BUILTIN_EXPECT(i < lc_imin, 0)) - { - ptrdiff_t const elt_count = lc_imin-i; - vec_store_nta_partial_hi(A[index],AL,elt_count); - vec_store_nta_partial_hi(alpha[index],alphaL,elt_count); - vec_store_nta_partial_hi(At11[index],At11L,elt_count); - vec_store_nta_partial_hi(At12[index],At12L,elt_count); - vec_store_nta_partial_hi(At13[index],At13L,elt_count); - vec_store_nta_partial_hi(At22[index],At22L,elt_count); - vec_store_nta_partial_hi(At23[index],At23L,elt_count); - vec_store_nta_partial_hi(At33[index],At33L,elt_count); - vec_store_nta_partial_hi(B1[index],B1L,elt_count); - vec_store_nta_partial_hi(B2[index],B2L,elt_count); - vec_store_nta_partial_hi(B3[index],B3L,elt_count); - vec_store_nta_partial_hi(beta1[index],beta1L,elt_count); - vec_store_nta_partial_hi(beta2[index],beta2L,elt_count); - vec_store_nta_partial_hi(beta3[index],beta3L,elt_count); - vec_store_nta_partial_hi(gt11[index],gt11L,elt_count); - vec_store_nta_partial_hi(gt12[index],gt12L,elt_count); - vec_store_nta_partial_hi(gt13[index],gt13L,elt_count); - vec_store_nta_partial_hi(gt22[index],gt22L,elt_count); - vec_store_nta_partial_hi(gt23[index],gt23L,elt_count); - vec_store_nta_partial_hi(gt33[index],gt33L,elt_count); - vec_store_nta_partial_hi(phi[index],phiL,elt_count); - vec_store_nta_partial_hi(trK[index],trKL,elt_count); - vec_store_nta_partial_hi(Xt1[index],Xt1L,elt_count); - vec_store_nta_partial_hi(Xt2[index],Xt2L,elt_count); - vec_store_nta_partial_hi(Xt3[index],Xt3L,elt_count); - continue; - } - - /* If necessary, store only partial vectors after the last iteration */ - - if (CCTK_REAL_VEC_SIZE > 1 && CCTK_BUILTIN_EXPECT(i+CCTK_REAL_VEC_SIZE > lc_imax, 0)) - { - ptrdiff_t const elt_count = lc_imax-i; - vec_store_nta_partial_lo(A[index],AL,elt_count); - vec_store_nta_partial_lo(alpha[index],alphaL,elt_count); - vec_store_nta_partial_lo(At11[index],At11L,elt_count); - vec_store_nta_partial_lo(At12[index],At12L,elt_count); - vec_store_nta_partial_lo(At13[index],At13L,elt_count); - vec_store_nta_partial_lo(At22[index],At22L,elt_count); - vec_store_nta_partial_lo(At23[index],At23L,elt_count); - vec_store_nta_partial_lo(At33[index],At33L,elt_count); - vec_store_nta_partial_lo(B1[index],B1L,elt_count); - vec_store_nta_partial_lo(B2[index],B2L,elt_count); - vec_store_nta_partial_lo(B3[index],B3L,elt_count); - vec_store_nta_partial_lo(beta1[index],beta1L,elt_count); - vec_store_nta_partial_lo(beta2[index],beta2L,elt_count); - vec_store_nta_partial_lo(beta3[index],beta3L,elt_count); - vec_store_nta_partial_lo(gt11[index],gt11L,elt_count); - vec_store_nta_partial_lo(gt12[index],gt12L,elt_count); - vec_store_nta_partial_lo(gt13[index],gt13L,elt_count); - vec_store_nta_partial_lo(gt22[index],gt22L,elt_count); - vec_store_nta_partial_lo(gt23[index],gt23L,elt_count); - vec_store_nta_partial_lo(gt33[index],gt33L,elt_count); - vec_store_nta_partial_lo(phi[index],phiL,elt_count); - vec_store_nta_partial_lo(trK[index],trKL,elt_count); - vec_store_nta_partial_lo(Xt1[index],Xt1L,elt_count); - vec_store_nta_partial_lo(Xt2[index],Xt2L,elt_count); - vec_store_nta_partial_lo(Xt3[index],Xt3L,elt_count); - break; - } - vec_store_nta(A[index],AL); - vec_store_nta(alpha[index],alphaL); - vec_store_nta(At11[index],At11L); - vec_store_nta(At12[index],At12L); - vec_store_nta(At13[index],At13L); - vec_store_nta(At22[index],At22L); - vec_store_nta(At23[index],At23L); - vec_store_nta(At33[index],At33L); - vec_store_nta(B1[index],B1L); - vec_store_nta(B2[index],B2L); - vec_store_nta(B3[index],B3L); - vec_store_nta(beta1[index],beta1L); - vec_store_nta(beta2[index],beta2L); - vec_store_nta(beta3[index],beta3L); - vec_store_nta(gt11[index],gt11L); - vec_store_nta(gt12[index],gt12L); - vec_store_nta(gt13[index],gt13L); - vec_store_nta(gt22[index],gt22L); - vec_store_nta(gt23[index],gt23L); - vec_store_nta(gt33[index],gt33L); - vec_store_nta(phi[index],phiL); - vec_store_nta(trK[index],trKL); - vec_store_nta(Xt1[index],Xt1L); - vec_store_nta(Xt2[index],Xt2L); - vec_store_nta(Xt3[index],Xt3L); + /* Copy local copies back to grid functions */ + vec_store_partial_prepare(i,lc_imin,lc_imax); + vec_store_nta_partial(A[index],AL); + vec_store_nta_partial(alpha[index],alphaL); + vec_store_nta_partial(At11[index],At11L); + vec_store_nta_partial(At12[index],At12L); + vec_store_nta_partial(At13[index],At13L); + vec_store_nta_partial(At22[index],At22L); + vec_store_nta_partial(At23[index],At23L); + vec_store_nta_partial(At33[index],At33L); + vec_store_nta_partial(B1[index],B1L); + vec_store_nta_partial(B2[index],B2L); + vec_store_nta_partial(B3[index],B3L); + vec_store_nta_partial(beta1[index],beta1L); + vec_store_nta_partial(beta2[index],beta2L); + vec_store_nta_partial(beta3[index],beta3L); + vec_store_nta_partial(gt11[index],gt11L); + vec_store_nta_partial(gt12[index],gt12L); + vec_store_nta_partial(gt13[index],gt13L); + vec_store_nta_partial(gt22[index],gt22L); + vec_store_nta_partial(gt23[index],gt23L); + vec_store_nta_partial(gt33[index],gt33L); + vec_store_nta_partial(phi[index],phiL); + vec_store_nta_partial(trK[index],trKL); + vec_store_nta_partial(Xt1[index],Xt1L); + vec_store_nta_partial(Xt2[index],Xt2L); + vec_store_nta_partial(Xt3[index],Xt3L); } - LC_ENDLOOP3VEC (ML_BSSN_boundary); + LC_ENDLOOP3VEC(ML_BSSN_boundary); } extern "C" void ML_BSSN_boundary(CCTK_ARGUMENTS) @@ -453,7 +355,16 @@ extern "C" void ML_BSSN_boundary(CCTK_ARGUMENTS) return; } - const char *groups[] = {"ML_BSSN::ML_curv","ML_BSSN::ML_dtlapse","ML_BSSN::ML_dtshift","ML_BSSN::ML_Gamma","ML_BSSN::ML_lapse","ML_BSSN::ML_log_confac","ML_BSSN::ML_metric","ML_BSSN::ML_shift","ML_BSSN::ML_trace_curv"}; + const char *const groups[] = { + "ML_BSSN::ML_curv", + "ML_BSSN::ML_dtlapse", + "ML_BSSN::ML_dtshift", + "ML_BSSN::ML_Gamma", + "ML_BSSN::ML_lapse", + "ML_BSSN::ML_log_confac", + "ML_BSSN::ML_metric", + "ML_BSSN::ML_shift", + "ML_BSSN::ML_trace_curv"}; GenericFD_AssertGroupStorage(cctkGH, "ML_BSSN_boundary", 9, groups); switch(fdOrder) @@ -471,7 +382,7 @@ extern "C" void ML_BSSN_boundary(CCTK_ARGUMENTS) break; } - GenericFD_LoopOverBoundaryWithGhosts(cctkGH, &ML_BSSN_boundary_Body); + GenericFD_LoopOverBoundaryWithGhosts(cctkGH, ML_BSSN_boundary_Body); if (verbose > 1) { |