Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3395e2e
update mom_flux_has_p in Castro_util
zhichen3 Sep 11, 2024
ba68c91
Merge branch 'development' into 2d_spherical_mom_flux_has_p
zhichen3 Sep 11, 2024
79562a8
change places associated with mom_flux_has_p except castro_ctu/mol_hy…
zhichen3 Sep 11, 2024
ca04f9e
fix incorrect calculation
zhichen3 Sep 11, 2024
442b5d8
remove redundant else and fix CoordSys::spherical -> CoordSys:SPHERICAL
zhichen3 Sep 11, 2024
8606de8
missing colon
zhichen3 Sep 11, 2024
3631380
fix typo
zhichen3 Sep 11, 2024
f9df3a7
add preprocessor to ensure we're in 2d or more
zhichen3 Sep 11, 2024
727f49f
fix compilation
zhichen3 Sep 11, 2024
0bd9707
fix typo
zhichen3 Sep 12, 2024
1c1df5e
update P_theta
zhichen3 Sep 12, 2024
7bc2606
update P_theta flux
zhichen3 Sep 16, 2024
b050905
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Sep 16, 2024
0ff40ae
change dtheta to rdtheta
zhichen3 Sep 17, 2024
579d949
do rdtheta correctly
zhichen3 Sep 17, 2024
765969f
fix compilation
zhichen3 Sep 17, 2024
810d9f9
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Oct 1, 2024
90fceb9
Merge branch 'development' into 2d_spherical_ptheta
zingale Oct 7, 2024
9c81874
Merge branch '2d_spherical_ptheta' of github.com:zhichen3/Castro into…
zhichen3 Oct 30, 2024
b280340
Revert "implement full well-balancing in PPM (#2945)"
zhichen3 Oct 30, 2024
199ebeb
Reapply "implement full well-balancing in PPM (#2945)"
zhichen3 Oct 30, 2024
a9dfeaa
add space
zhichen3 Oct 31, 2024
ebb142c
update pressure scaling with area and coarse volume
zhichen3 Nov 12, 2024
b9fe28f
Merge branch '2d_spherical_ptheta' of github.com:zhichen3/Castro into…
zhichen3 Nov 12, 2024
28a74b5
update benchmark
zhichen3 Nov 12, 2024
47af504
Revert "update benchmark"
zhichen3 Nov 12, 2024
99464ed
update benchmark
zhichen3 Nov 12, 2024
b11b943
updae benchmark
zhichen3 Nov 12, 2024
fc7cfce
fix ptheta reflux
zhichen3 Nov 15, 2024
8bd8b60
fix typo
zhichen3 Nov 15, 2024
ef467a6
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Nov 18, 2024
727f52e
fix compile
zhichen3 Nov 18, 2024
4ae407c
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 May 13, 2025
0326e19
add some comments and a minor fix
zhichen3 May 14, 2025
8aff1bd
update test
zhichen3 May 14, 2025
0510976
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 May 29, 2025
334c359
Merge branch '2d_spherical_ptheta' of github.com:zhichen3/Castro into…
zhichen3 May 29, 2025
2c2507b
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Jul 19, 2025
1c4af0e
update ci
zhichen3 Jul 19, 2025
ebaa465
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Aug 9, 2025
6005409
fix
zhichen3 Aug 9, 2025
fa71344
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Sep 5, 2025
572db0f
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Sep 15, 2025
17c132e
Merge branch '2d_spherical_ptheta' of github.com:zhichen3/Castro into…
zhichen3 Sep 15, 2025
d8f91d4
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Sep 15, 2025
b17fcb7
correct nodalbox dir in loop
zhichen3 Sep 17, 2025
92284e9
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Sep 21, 2025
9b3b29a
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Sep 23, 2025
43e2008
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Dec 21, 2025
4b5ae6c
update benchmark
zhichen3 Dec 21, 2025
49cd0c2
Merge branch '2d_spherical_ptheta' of github.com:zhichen3/Castro into…
zhichen3 Feb 7, 2026
dd00ed1
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Jun 3, 2026
078c175
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Jun 8, 2026
da58dd3
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Jun 25, 2026
ab6e150
Revert "thin out the plotfile frequency (#3346)"
zhichen3 Aug 24, 2026
a943350
Merge branch '2d_spherical_ptheta' of github.com:zhichen3/Castro into…
zhichen3 Aug 24, 2026
0e8c626
update submodule hash
zhichen3 Aug 24, 2026
de1eebd
Merge branch 'development' into 2d_spherical_ptheta
zhichen3 Aug 24, 2026
a874995
Reapply "thin out the plotfile frequency (#3346)"
zhichen3 Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
plotfile = plt00086
time = 1.25
variables minimum value maximum value
density 8.6940338039e-05 19441641.404
xmom -5.4953770558e+14 1.3594264808e+14
ymom -2.4933244206e+15 2.4933251729e+15
density 8.7357118639e-05 19430545.7
xmom -5.4899611972e+14 1.3502124975e+14
ymom -2.4942903676e+15 2.4942903672e+15
zmom 0 0
rho_E 7.4973602186e+11 5.0768249302e+24
rho_e 7.1068648972e+11 5.0744784597e+24
Temp 242282.60874 1404450065.3
rho_He4 8.6940338039e-17 3.3980876296
rho_C12 3.4776135215e-05 7775851.0286
rho_O16 5.2164202823e-05 11664450.983
rho_Ne20 8.6940338039e-17 172486.25459
rho_Mg24 8.6940338039e-17 1043.0854443
rho_Si28 8.6940338039e-17 5.9870930966
rho_S32 8.6940338039e-17 0.00016460178455
rho_Ar36 8.6940338039e-17 1.9441643904e-05
rho_Ca40 8.6940338039e-17 1.9441641599e-05
rho_Ti44 8.6940338039e-17 1.9441641468e-05
rho_Cr48 8.6940338039e-17 1.9441641465e-05
rho_Fe52 8.6940338039e-17 1.9441641465e-05
rho_Ni56 8.6940338039e-17 1.9441641465e-05
rho_E 1.1708526936e+12 5.0796765656e+24
rho_e 1.1071097588e+12 5.0773720951e+24
Temp 265286.90326 1411724449.2
rho_He4 8.7357118639e-17 3.721331829
rho_C12 3.4942847455e-05 7771349.199
rho_O16 5.2414271183e-05 11657751.712
rho_Ne20 8.7357118639e-17 189502.87202
rho_Mg24 8.7357118639e-17 1284.4110655
rho_Si28 8.7357118639e-17 7.1480863104
rho_S32 8.7357118639e-17 0.0002130320139
rho_Ar36 8.7357118639e-17 1.9430548918e-05
rho_Ca40 8.7357118639e-17 1.9430545919e-05
rho_Ti44 8.7357118639e-17 1.9430545769e-05
rho_Cr48 8.7357118639e-17 1.9430545765e-05
rho_Fe52 8.7357118639e-17 1.9430545765e-05
rho_Ni56 8.7357118639e-17 1.9430545765e-05
Shock 0 1
phiGrav -5.8707431189e+17 -2.337549858e+16
grav_x -685044085.35 -51428.268861
grav_y -739591083.9 739591039.39
phiGrav -5.870522222e+17 -2.3375498723e+16
grav_x -685017818.43 -51428.283425
grav_y -739492913.39 739492913.53
grav_z 0 0
rho_enuc 0 7.1503919723e+23
rho_enuc 0 8.1320260393e+23

3 changes: 3 additions & 0 deletions Source/driver/Castro.H
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,9 @@ protected:
#if (AMREX_SPACEDIM <= 2)
amrex::MultiFab P_radial;
#endif
#if (AMREX_SPACEDIM == 2)
amrex::MultiFab P_theta;
#endif
#ifdef RADIATION
amrex::Vector<std::unique_ptr<amrex::MultiFab> > rad_fluxes;
#endif
Expand Down
65 changes: 62 additions & 3 deletions Source/driver/Castro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,12 @@ Castro::initMFs()
}
#endif

#if (AMREX_SPACEDIM == 2)
if (Geom().IsSPHERICAL()) {
P_theta.define(getEdgeBoxArray(1), dmap, 1, 0);
}
#endif

#ifdef RADIATION
if (Radiation::rad_hydro_combined) {
rad_fluxes.resize(AMREX_SPACEDIM);
Expand Down Expand Up @@ -2619,6 +2625,12 @@ Castro::FluxRegCrseInit() {
}
#endif

#if (AMREX_SPACEDIM == 2)
if (Geom().IsSPHERICAL()) {
fine_level.pres_reg.CrseInit(P_theta, 1, 0, 0, 1, pres_crse_scale);
}
#endif

#ifdef RADIATION
if (Radiation::rad_hydro_combined) {
for (int i = 0; i < AMREX_SPACEDIM; ++i) {
Expand Down Expand Up @@ -2649,6 +2661,12 @@ Castro::FluxRegFineAdd() {
}
#endif

#if (AMREX_SPACEDIM == 2)
if (Geom().IsSPHERICAL()) {
getLevel(level).pres_reg.FineAdd(P_theta, 1, 0, 0, 1, pres_fine_scale);
}
#endif

#ifdef RADIATION
if (Radiation::rad_hydro_combined) {
for (int i = 0; i < AMREX_SPACEDIM; ++i) {
Expand Down Expand Up @@ -2884,14 +2902,22 @@ Castro::reflux (int crse_level, int fine_level, bool in_post_timestep)
#if (AMREX_SPACEDIM <= 2)
if (!Geom().IsCartesian()) {

// Get pressure flux register of this level.

reg = &getLevel(lev).pres_reg;

MultiFab dr(crse_lev.grids, crse_lev.dmap, 1, 0);
dr.setVal(crse_lev.geom.CellSize(0));
// Clear out flux at the internal borders,
// i.e. not the borders between coarse and fine boxes.

reg->ClearInternalBorders(crse_lev.geom);

reg->Reflux(crse_state, dr, 1.0, 0, UMX, 1, crse_lev.geom);
// Perform the reflux
// i.e. U^{c, new} = U^{c, old} + (Σ p^f A^f dt^f - p^c A^c dt^c) / V^c
// Note that the pressure flux register holds what's inside the parenthesis
// And this is only done for U = UMX for radial pressure flux register
// which is stored in the 0-dir of pres_reg.

reg->Reflux(crse_state, crse_lev.volume, 0, 1.0, 0, UMX, 1, crse_lev.geom);

if (update_sources_after_reflux || !in_post_timestep) {

Expand All @@ -2913,6 +2939,39 @@ Castro::reflux (int crse_level, int fine_level, bool in_post_timestep)

}

#if (AMREX_SPACEDIM == 2)
// Now deal with theta pressure flux register with 2d spherical geometry

if (Geom().IsSPHERICAL()) {

// Do reflux, but note theta pressure flux register is stored
// in the 1-dir of pres_reg. And it is only applied for U=UMY.

reg->Reflux(crse_state, crse_lev.volume, 1, 1.0, 0, UMY, 1, crse_lev.geom);

if (update_sources_after_reflux || !in_post_timestep) {

MultiFab tmp_fluxes(crse_lev.P_theta.boxArray(),
crse_lev.P_theta.DistributionMap(),
crse_lev.P_theta.nComp(), crse_lev.P_theta.nGrow());

tmp_fluxes.setVal(0.0);

for (OrientationIter fi; fi.isValid(); ++fi)
{
const FabSet& fs = (*reg)[fi()];
if (fi().coordDir() == 1) {
fs.copyTo(tmp_fluxes, 0, 0, 0, tmp_fluxes.nComp());
}
}

MultiFab::Add(crse_lev.P_theta, tmp_fluxes, 0, 0, crse_lev.P_theta.nComp(), 0);

}

}
#endif

reg->setVal(0.0);

}
Expand Down
6 changes: 6 additions & 0 deletions Source/driver/Castro_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ Castro::initialize_advance(Real time, Real dt, int amr_iteration)
}
#endif

#if (AMREX_SPACEDIM == 2)
if (Geom().IsSPHERICAL()) {
P_theta.setVal(0.0);
}
#endif

#ifdef RADIATION
if (Radiation::rad_hydro_combined) {
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
Expand Down
6 changes: 6 additions & 0 deletions Source/driver/Castro_advance_ctu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ Castro::retry_advance_ctu(Real dt, const advance_status& status)
}
#endif

#if (AMREX_SPACEDIM == 2)
if (Geom().IsSPHERICAL()) {
getLevel(lev).P_theta.setVal(0.0);
}
#endif

#ifdef RADIATION
if (Radiation::rad_hydro_combined) {
for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
Expand Down
39 changes: 38 additions & 1 deletion Source/hydro/Castro_ctu_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
#if AMREX_SPACEDIM <= 2
FArrayBox pradial(The_Async_Arena());
#endif
#if AMREX_SPACEDIM == 2
FArrayBox ptheta(The_Async_Arena());
#endif
#if AMREX_SPACEDIM == 3
FArrayBox qmyx(The_Async_Arena()), qpyx(The_Async_Arena());
FArrayBox qmzx(The_Async_Arena()), qpzx(The_Async_Arena());
Expand Down Expand Up @@ -456,6 +459,13 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
fab_size += pradial.nBytes();
#endif

#if AMREX_SPACEDIM == 2
if (Geom().IsSPHERICAL()) {
ptheta.resize(ybx, 1);
}
fab_size += ptheta.nBytes();
#endif

#ifdef REACTIONS
auto sdc_src_arr = castro::time_integration_method == SimplifiedSpectralDeferredCorrections ?
SDC_react_source.array(mfi) : Array4<Real const>{};
Expand Down Expand Up @@ -1275,10 +1285,25 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
amrex::ParallelFor(nbx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pradial_fab(i,j,k) = qex_arr(i,j,k,GDPRES) * dt;
pradial_fab(i,j,k) = area_arr(i,j,k) * qex_arr(i,j,k,GDPRES) * dt;
});
}
#endif

#if AMREX_SPACEDIM == 2
// get the scaled pressure in the theta direction

if (idir == 1 && !mom_flux_has_p(1, 1, coord)) {
Array4<Real> ptheta_fab = ptheta.array();

amrex::ParallelFor(nbx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
ptheta_fab(i,j,k) = area_arr(i,j,k) * qey_arr(i,j,k,GDPRES) * dt;
});
}
#endif

// Store the fluxes from this advance. For simplified SDC integration we
// only need to do this on the last iteration.

Expand Down Expand Up @@ -1322,7 +1347,19 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co
P_radial_fab(i,j,k,0) += pradial_fab(i,j,k,0);
});
}
#endif

#if AMREX_SPACEDIM == 2
if (idir == 1 && !mom_flux_has_p(1, 1, coord)) {
Array4<Real> ptheta_fab = ptheta.array();
Array4<Real> P_theta_fab = P_theta.array(mfi);

amrex::ParallelFor(mfi.nodaltilebox(1),
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
P_theta_fab(i,j,k,0) += ptheta_fab(i,j,k,0);
});
}
#endif

} // add_fluxes
Expand Down
44 changes: 42 additions & 2 deletions Source/hydro/Castro_mol_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
}
#if AMREX_SPACEDIM <= 2
FArrayBox pradial(The_Async_Arena());
#endif
#if AMREX_SPACEDIM == 2
FArrayBox ptheta(The_Async_Arena());
#endif
FArrayBox avis(The_Async_Arena());

Expand Down Expand Up @@ -649,8 +652,12 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
if (!Geom().IsCartesian()) {
pradial.resize(xbx, 1);
}
#endif

Array4<Real> pradial_fab = pradial.array();
#if AMREX_SPACEDIM == 2
if (Geom().IsSPHERICAL()) {
ptheta.resize(ybx, 1);
}
#endif

for (int idir = 0; idir < AMREX_SPACEDIM; ++idir) {
Expand All @@ -666,15 +673,32 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
// get the scaled radial pressure -- we need to treat this specially

if (idir == 0 && !mom_flux_has_p(0, 0, coord)) {
Array4<Real> pradial_fab = pradial.array();
Array4<Real> const qex_arr = qe[idir].array();

amrex::ParallelFor(nbx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pradial_fab(i,j,k) = qex_arr(i,j,k,GDPRES) * dt;
pradial_fab(i,j,k) = area_arr(i,j,k) * qex_arr(i,j,k,GDPRES) * dt;
});
}
#endif

#if AMREX_SPACEDIM == 2
// get the scaled pressure in the theta direction

if (idir == 1 && !mom_flux_has_p(1, 1, coord)) {
Array4<Real> ptheta_fab = ptheta.array();
Array4<Real> const qey_arr = qe[idir].array();

amrex::ParallelFor(nbx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
ptheta_fab(i,j,k) = area_arr(i,j,k) * qey_arr(i,j,k,GDPRES) * dt;
});
}
#endif

}


Expand Down Expand Up @@ -703,6 +727,7 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
#if AMREX_SPACEDIM <= 2
if (!Geom().IsCartesian()) {

Array4<Real> pradial_fab = pradial.array();
Array4<Real> P_radial_fab = P_radial.array(mfi);
const Real scale = stage_weight;

Expand All @@ -713,6 +738,21 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)

}
#endif

#if AMREX_SPACEDIM == 2
if (Geom().IsSPHERICAL()) {

Array4<Real> ptheta_fab = ptheta.array();
Array4<Real> P_theta_fab = P_theta.array(mfi);
const Real scale = stage_weight;

AMREX_HOST_DEVICE_FOR_4D(mfi.nodaltilebox(1), 1, i, j, k, n,
{
P_theta_fab(i,j,k,0) += scale * ptheta_fab(i,j,k,0);
});

}
#endif
}

} // MFIter loop
Expand Down
Loading