Skip to content

Commit

Permalink
Merge branch 'main' into c2p
Browse files Browse the repository at this point in the history
  • Loading branch information
jaykalinani committed Aug 13, 2024
2 parents 050d849 + 07cfaad commit eebc627
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

# The type of runner that the job will run on
runs-on: ubuntu-latest
container: einsteintoolkit/carpetx:${{matrix.accelerator}}-${{matrix.real-precision}}
container: lwji/carpetx:${{matrix.accelerator}}-${{matrix.real-precision}}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
1 change: 1 addition & 0 deletions AsterX/schedule.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ SCHEDULE AsterX_Fluxes IN AsterX_RHSGroup
READS: dens(everywhere) tau(everywhere) mom(everywhere)
READS: HydroBaseX::rho(everywhere) HydroBaseX::vel(everywhere) HydroBaseX::press(everywhere) HydroBaseX::eps(everywhere)
READS: HydroBaseX::Bvec(everywhere)
READS: dBx_stag(everywhere) dBy_stag(everywhere) dBz_stag(everywhere)
READS: Avec_x(everywhere) Avec_y(everywhere) Avec_z(everywhere) Psi(everywhere)
WRITES: flux_x(interior) flux_y(interior) flux_z(interior)
WRITES: Aux_in_RHSof_A_Psi(interior)
Expand Down
29 changes: 25 additions & 4 deletions AsterX/src/fluxes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void CalcFlux(CCTK_ARGUMENTS, EOSType &eos_th) {
/* grid functions */
const vec<GF3D2<const CCTK_REAL>, dim> gf_vels{velx, vely, velz};
const vec<GF3D2<const CCTK_REAL>, dim> gf_Bvecs{Bvecx, Bvecy, Bvecz};
const vec<GF3D2<const CCTK_REAL>, dim> gf_dBstags{dBx_stag, dBy_stag, dBz_stag};
const vec<GF3D2<const CCTK_REAL>, dim> gf_beta{betax, betay, betaz};
const smat<GF3D2<const CCTK_REAL>, dim> gf_g{gxx, gxy, gxz, gyy, gyz, gzz};

Expand Down Expand Up @@ -156,6 +157,10 @@ void CalcFlux(CCTK_ARGUMENTS, EOSType &eos_th) {
constexpr array<int, dim> face_centred = {!(dir == 0), !(dir == 1),
!(dir == 2)};

constexpr array<int, dim> dir_arr = {(dir==0) ? 2 : ( (dir==1) ? 0 : 1 ),
dir,
(dir==0) ? 1 : ( (dir==1) ? 2 : 0 )};

grid.loop_int_device<
face_centred[0], face_centred[1],
face_centred
Expand Down Expand Up @@ -194,10 +199,6 @@ void CalcFlux(CCTK_ARGUMENTS, EOSType &eos_th) {
eos_th.press_from_valid_rho_eps_ye(rho_rc(1), eps_min, ye_rc(1));
}

const vec<vec<CCTK_REAL, 2>, 3> Bs_rc([&](int i) ARITH_INLINE {
return vec<CCTK_REAL, 2>{reconstruct_pt(gf_Bvecs(i), p, false, false)};
});

/* Interpolate metric components from vertices to faces */
const CCTK_REAL alp_avg = calc_avg_v2f(alp, p, dir);
const vec<CCTK_REAL, 3> betas_avg(
Expand All @@ -222,6 +223,26 @@ void CalcFlux(CCTK_ARGUMENTS, EOSType &eos_th) {
return 1 / sqrt(1 - calc_contraction(vlows_rc, vels_rc)(f));
});

// Introduce reconstructed Bs
// Use staggered dB for i == dir

vec<vec<CCTK_REAL, 2>, 3> Bs_rc;
array<CCTK_REAL,2> Bs_rc_dummy; // note: can't copy array<,2> to vec<,2>, only construct

Bs_rc(dir)(0) = gf_dBstags(dir)(p.I)/sqrtg;
Bs_rc(dir)(1) = Bs_rc(dir)(0);

Bs_rc_dummy = reconstruct_pt(gf_Bvecs(dir_arr[0]), p, false, false);
Bs_rc(dir_arr[0])(0) = Bs_rc_dummy[0];
Bs_rc(dir_arr[0])(1) = Bs_rc_dummy[1];

Bs_rc_dummy = reconstruct_pt(gf_Bvecs(dir_arr[2]), p, false, false);
Bs_rc(dir_arr[2])(0) = Bs_rc_dummy[0];
Bs_rc(dir_arr[2])(1) = Bs_rc_dummy[1];

// End of setting Bs


/* alpha * b0 = W * B^i * v_i */
const vec<CCTK_REAL, 2> alp_b0_rc([&](int f) ARITH_INLINE {
return w_lorentz_rc(f) * calc_contraction(Bs_rc, vlows_rc)(f);
Expand Down

0 comments on commit eebc627

Please sign in to comment.