Skip to content

Commit

Permalink
CarpetX: Correct ENO operators
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Oct 25, 2024
1 parent 485b9ea commit 40be639
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 28 deletions.
115 changes: 94 additions & 21 deletions CarpetX/src/driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ amrex::Interpolater *get_interpolator(const std::array<int, dim> indextype) {
return interp_t::natural;
else if (CCTK_EQUALS(prolongation_type, "poly-cons3lfb"))
return interp_t::poly_cons3lfb;
else if (CCTK_EQUALS(prolongation_type, "poly-eno3lfb"))
return interp_t::poly_eno3lfb;
else
assert(0);
}();
Expand Down Expand Up @@ -848,27 +850,6 @@ amrex::Interpolater *get_interpolator(const std::array<int, dim> indextype) {

switch (prolongation_order) {

case 1:
switch ((indextype[0] << 2) | (indextype[1] << 1) | (indextype[2] << 0)) {
case 0b000:
return &prolongate_eno_3d_rf2_c000_o1;
case 0b001:
return &prolongate_eno_3d_rf2_c001_o1;
case 0b010:
return &prolongate_eno_3d_rf2_c010_o1;
case 0b011:
return &prolongate_eno_3d_rf2_c011_o1;
case 0b100:
return &prolongate_eno_3d_rf2_c100_o1;
case 0b101:
return &prolongate_eno_3d_rf2_c101_o1;
case 0b110:
return &prolongate_eno_3d_rf2_c110_o1;
case 0b111:
return &prolongate_eno_3d_rf2_c111_o1;
}
break;

case 3:
switch ((indextype[0] << 2) | (indextype[1] << 1) | (indextype[2] << 0)) {
case 0b000:
Expand Down Expand Up @@ -1164,6 +1145,98 @@ amrex::Interpolater *get_interpolator(const std::array<int, dim> indextype) {
}
break;

case interp_t::poly_eno3lfb:

switch (prolongation_order) {

case 1:
switch ((indextype[0] << 2) | (indextype[1] << 1) | (indextype[2] << 0)) {
case 0b000:
return &prolongate_poly_eno3lfb_3d_rf2_c000_o1;
case 0b001:
return &prolongate_poly_eno3lfb_3d_rf2_c001_o1;
case 0b010:
return &prolongate_poly_eno3lfb_3d_rf2_c010_o1;
case 0b011:
return &prolongate_poly_eno3lfb_3d_rf2_c011_o1;
case 0b100:
return &prolongate_poly_eno3lfb_3d_rf2_c100_o1;
case 0b101:
return &prolongate_poly_eno3lfb_3d_rf2_c101_o1;
case 0b110:
return &prolongate_poly_eno3lfb_3d_rf2_c110_o1;
case 0b111:
return &prolongate_poly_eno3lfb_3d_rf2_c111_o1;
}
break;

case 3:
switch ((indextype[0] << 2) | (indextype[1] << 1) | (indextype[2] << 0)) {
case 0b000:
return &prolongate_poly_eno3lfb_3d_rf2_c000_o3;
case 0b001:
return &prolongate_poly_eno3lfb_3d_rf2_c001_o3;
case 0b010:
return &prolongate_poly_eno3lfb_3d_rf2_c010_o3;
case 0b011:
return &prolongate_poly_eno3lfb_3d_rf2_c011_o3;
case 0b100:
return &prolongate_poly_eno3lfb_3d_rf2_c100_o3;
case 0b101:
return &prolongate_poly_eno3lfb_3d_rf2_c101_o3;
case 0b110:
return &prolongate_poly_eno3lfb_3d_rf2_c110_o3;
case 0b111:
return &prolongate_poly_eno3lfb_3d_rf2_c111_o3;
}
break;

case 5:
switch ((indextype[0] << 2) | (indextype[1] << 1) | (indextype[2] << 0)) {
case 0b000:
return &prolongate_poly_eno3lfb_3d_rf2_c000_o5;
case 0b001:
return &prolongate_poly_eno3lfb_3d_rf2_c001_o5;
case 0b010:
return &prolongate_poly_eno3lfb_3d_rf2_c010_o5;
case 0b011:
return &prolongate_poly_eno3lfb_3d_rf2_c011_o5;
case 0b100:
return &prolongate_poly_eno3lfb_3d_rf2_c100_o5;
case 0b101:
return &prolongate_poly_eno3lfb_3d_rf2_c101_o5;
case 0b110:
return &prolongate_poly_eno3lfb_3d_rf2_c110_o5;
case 0b111:
return &prolongate_poly_eno3lfb_3d_rf2_c111_o5;
}
break;

#if 0
case 7:
switch ((indextype[0] << 2) | (indextype[1] << 1) | (indextype[2] << 0)) {
case 0b000:
return &prolongate_poly_eno3lfb_3d_rf2_c000_o7;
case 0b001:
return &prolongate_poly_eno3lfb_3d_rf2_c001_o7;
case 0b010:
return &prolongate_poly_eno3lfb_3d_rf2_c010_o7;
case 0b011:
return &prolongate_poly_eno3lfb_3d_rf2_c011_o7;
case 0b100:
return &prolongate_poly_eno3lfb_3d_rf2_c100_o7;
case 0b101:
return &prolongate_poly_eno3lfb_3d_rf2_c101_o7;
case 0b110:
return &prolongate_poly_eno3lfb_3d_rf2_c110_o7;
case 0b111:
return &prolongate_poly_eno3lfb_3d_rf2_c111_o7;
}
break;
#endif
}
break;

case interp_t::unset:
// do nothing; errors are handled below
break;
Expand Down
14 changes: 7 additions & 7 deletions CarpetX/src/prolongate_3d_rf2.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -386,19 +386,19 @@ extern prolongate_3d_rf2<CC, CC, CC, ENO, ENO, ENO, 2, 2, 2, FB_NONE>

extern prolongate_3d_rf2<VC, VC, VC, POLY, POLY, POLY, 5, 5, 5, FB_NONE>
prolongate_eno_3d_rf2_c000_o5;
extern prolongate_3d_rf2<VC, VC, CC, POLY, POLY, ENO, 5, 5, 4, FB_NONE>
extern prolongate_3d_rf2<VC, VC, CC, POLY, POLY, ENO, 5, 5, 2, FB_NONE>
prolongate_eno_3d_rf2_c001_o5;
extern prolongate_3d_rf2<VC, CC, VC, POLY, ENO, POLY, 5, 4, 5, FB_NONE>
extern prolongate_3d_rf2<VC, CC, VC, POLY, ENO, POLY, 5, 2, 5, FB_NONE>
prolongate_eno_3d_rf2_c010_o5;
extern prolongate_3d_rf2<VC, CC, CC, POLY, ENO, ENO, 5, 4, 4, FB_NONE>
extern prolongate_3d_rf2<VC, CC, CC, POLY, ENO, ENO, 5, 2, 2, FB_NONE>
prolongate_eno_3d_rf2_c011_o5;
extern prolongate_3d_rf2<CC, VC, VC, ENO, POLY, POLY, 4, 5, 5, FB_NONE>
extern prolongate_3d_rf2<CC, VC, VC, ENO, POLY, POLY, 2, 5, 5, FB_NONE>
prolongate_eno_3d_rf2_c100_o5;
extern prolongate_3d_rf2<CC, VC, CC, ENO, POLY, ENO, 4, 5, 4, FB_NONE>
extern prolongate_3d_rf2<CC, VC, CC, ENO, POLY, ENO, 2, 5, 2, FB_NONE>
prolongate_eno_3d_rf2_c101_o5;
extern prolongate_3d_rf2<CC, CC, VC, ENO, ENO, POLY, 4, 4, 5, FB_NONE>
extern prolongate_3d_rf2<CC, CC, VC, ENO, ENO, POLY, 2, 2, 5, FB_NONE>
prolongate_eno_3d_rf2_c110_o5;
extern prolongate_3d_rf2<CC, CC, CC, ENO, ENO, ENO, 4, 4, 4, FB_NONE>
extern prolongate_3d_rf2<CC, CC, CC, ENO, ENO, ENO, 2, 2, 2, FB_NONE>
prolongate_eno_3d_rf2_c111_o5;

// Hermite interpolation
Expand Down

0 comments on commit 40be639

Please sign in to comment.