diff options
Diffstat (limited to 'src/GRHydro_PPMReconstruct_drv_opt.cc')
-rw-r--r-- | src/GRHydro_PPMReconstruct_drv_opt.cc | 107 |
1 files changed, 71 insertions, 36 deletions
diff --git a/src/GRHydro_PPMReconstruct_drv_opt.cc b/src/GRHydro_PPMReconstruct_drv_opt.cc index 9b70d2c..7ed18de 100644 --- a/src/GRHydro_PPMReconstruct_drv_opt.cc +++ b/src/GRHydro_PPMReconstruct_drv_opt.cc @@ -89,15 +89,13 @@ void CCTK_FNAME(GRHydro_PPMReconstruct_drv_opt)(cGH const * const restrict & res // trivialz = SpaceMask_GetStateBits("Hydro_RiemannProblemZ","trivial"); not_trivialz = SpaceMask_GetStateBits("Hydro_RiemannProblemZ","not_trivial"); - // ENHANCED PPM IS NOT IMPLEMENTED - // logical :: apply_enhanced_ppm - // ! if use_enhanced_ppm, allow old PPM on one level - // if (GRHydro_oppm_reflevel .eq. (-1) .or. & - // GRHydro_reflevel .ne. GRHydro_oppm_reflevel) then - // apply_enhanced_ppm = use_enhanced_ppm .ne. 0 - // else - // apply_enhanced_ppm = .false. - // end if + // if use_enhanced_ppm, allow old PPM on one level + bool apply_enhanced_ppm = false; + if (GRHydro_oppm_reflevel == (-1) || + *GRHydro_reflevel != GRHydro_oppm_reflevel) + apply_enhanced_ppm = use_enhanced_ppm != 0; + else + apply_enhanced_ppm = false; int i,j,k; @@ -178,54 +176,91 @@ void CCTK_FNAME(GRHydro_PPMReconstruct_drv_opt)(cGH const * const restrict & res double* restrict Bvcyplus, \ double* restrict Bvczplus, \ double* restrict psidcplus); - static ppm1d_cxx_ptr_t ppm1d_cxx_funcs[32]; + static ppm1d_cxx_ptr_t ppm1d_cxx_funcs[64]; ppm1d_cxx_ptr_t ppm1d_cxx_func; - #define MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect) ((do_temp<<4)|(do_ye<<3)|(do_mhd<<2)|(dc_flag<<1)|(do_ppm_detect)) - #define SETPOINTER(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect) \ - ppm1d_cxx_funcs[MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect)] = \ - GRHydro_ppm1d_cxx<do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect> - + #define MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect,do_eppm) ((do_eppm<<5)|(do_temp<<4)|(do_ye<<3)|(do_mhd<<2)|(dc_flag<<1)|(do_ppm_detect)) + #define SETPOINTER(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect,do_eppm) \ + if (!do_eppm) \ + ppm1d_cxx_funcs[MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect, do_eppm)] = \ + GRHydro_ppm1d_cxx<do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect>; \ + else \ + ppm1d_cxx_funcs[MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect, do_eppm)] = \ + GRHydro_eppm1d_cxx<do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect>; + + // --- original PPM // first stuff without MHD - SETPOINTER(false,false,false,false,false); - SETPOINTER(false,false,false,false,true); + SETPOINTER(false,false,false,false,false,false); + SETPOINTER(false,false,false,false,true,false); // do_temp can only be true of do_ye is also true - SETPOINTER(true,true,false,false,false); - SETPOINTER(true,true,false,false,true); + SETPOINTER(true,true,false,false,false,false); + SETPOINTER(true,true,false,false,true,false); // but do_ye can be true and do_temp can be false - SETPOINTER(false,true,false,false,false); - SETPOINTER(false,true,false,false,true); + SETPOINTER(false,true,false,false,false,false); + SETPOINTER(false,true,false,false,true,false); // with MHD, but dc_flag false - SETPOINTER(false,false,true,false,false); - SETPOINTER(false,false,true,false,true); + SETPOINTER(false,false,true,false,false,false); + SETPOINTER(false,false,true,false,true,false); // do_temp can only be true of do_ye is also true - SETPOINTER(true,true,true,false,false); - SETPOINTER(true,true,true,false,true); + SETPOINTER(true,true,true,false,false,false); + SETPOINTER(true,true,true,false,true,false); // but do_ye can be true and do_temp can be false - SETPOINTER(false,true,true,false,false); - SETPOINTER(false,true,true,false,true); + SETPOINTER(false,true,true,false,false,false); + SETPOINTER(false,true,true,false,true,false); // with MHD, dc_flag true - SETPOINTER(false,false,true,true,false); - SETPOINTER(false,false,true,true,true); + SETPOINTER(false,false,true,true,false,false); + SETPOINTER(false,false,true,true,true,false); + // do_temp can only be true of do_ye is also true + SETPOINTER(true,true,true,true,false,false); + SETPOINTER(true,true,true,true,true,false); + // but do_ye can be true and do_temp can be false + SETPOINTER(false,true,true,true,false,false); + SETPOINTER(false,true,true,true,true,false); + + // ---- enhanced PPM + // first stuff without MHD + SETPOINTER(false,false,false,false,false,true); + SETPOINTER(false,false,false,false,true,true); + // do_temp can only be true of do_ye is also true + SETPOINTER(true,true,false,false,false,true); + SETPOINTER(true,true,false,false,true,true); + // but do_ye can be true and do_temp can be false + SETPOINTER(false,true,false,false,false,true); + SETPOINTER(false,true,false,false,true,true); + + // with MHD, but dc_flag false + SETPOINTER(false,false,true,false,false,true); + SETPOINTER(false,false,true,false,true,true); // do_temp can only be true of do_ye is also true - SETPOINTER(true,true,true,true,false); - SETPOINTER(true,true,true,true,true); + SETPOINTER(true,true,true,false,false,true); + SETPOINTER(true,true,true,false,true,true); // but do_ye can be true and do_temp can be false - SETPOINTER(false,true,true,true,false); - SETPOINTER(false,true,true,true,true); + SETPOINTER(false,true,true,false,false,true); + SETPOINTER(false,true,true,false,true,true); + // with MHD, dc_flag true + SETPOINTER(false,false,true,true,false,true); + SETPOINTER(false,false,true,true,true,true); + // do_temp can only be true of do_ye is also true + SETPOINTER(true,true,true,true,false,true); + SETPOINTER(true,true,true,true,true,true); + // but do_ye can be true and do_temp can be false + SETPOINTER(false,true,true,true,false,true); + SETPOINTER(false,true,true,true,true,true); + + const bool do_temp = *evolve_temper; const bool do_ye = *evolve_Y_e; const bool do_mhd = *evolve_MHD; const bool dc_flag = clean_divergence; const bool do_ppm_detect = ppm_detect; - ppm1d_cxx_func = ppm1d_cxx_funcs[MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect)]; + ppm1d_cxx_func = ppm1d_cxx_funcs[MKINDEX(do_temp,do_ye,do_mhd,dc_flag,do_ppm_detect,apply_enhanced_ppm)]; if(ppm1d_cxx_func == NULL) { CCTK_VError(__LINE__, __FILE__, CCTK_THORNSTRING, - "Combination do_temp = %d do_ye = %d do_mhd = %d dc_flag = %d do_ppm_detect = %d is not supported for PPM. Please instatate the respective template", - do_temp, do_ye, do_mhd, dc_flag, do_ppm_detect); + "Combination do_temp = %d do_ye = %d do_mhd = %d dc_flag = %d do_ppm_detect = %d do_eppm = %d is not supported for PPM. Please instantiate the respective template", + do_temp, do_ye, do_mhd, dc_flag, do_ppm_detect, apply_enhanced_ppm); } //index = i + j*nx + k*nx*ny; |