Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 9 additions & 5 deletions Source/CAMR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,13 +1312,17 @@ CAMR::ZeroingOutForPlotting(amrex::MultiFab& S)
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
if (vfrac_arr(i,j,k) == 0.0)
{
for (int n = 0; n < ncomp; ++n) {
Sarr(i, j, k, n) = 0.0;
for (int n = 0; n < ncomp; ++n) {
Sarr(i, j, k, n) = 0.0;
}
}
{
}
else
{
// Clean up denormal-scale noise only. Note that we must test the
// magnitude here -- a signed test would zero every legitimately
// negative value, e.g. all negative momenta and velocities.
for (int n = 0; n < ncomp; ++n) {
if(Sarr(i, j, k, n) < 1e-12){
if (amrex::Math::abs(Sarr(i, j, k, n)) < 1.e-12) {
Sarr(i, j, k, n) = 0.0;
}
}
Expand Down
7 changes: 6 additions & 1 deletion Source/Utils/CAMR_reset_internal_e.H
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,16 @@ CAMR_reset_internal_e(
S(i, j, k, UEDEN) = S(i,j,k,UEINT) + rho * ke;

} else if (S(i,j,k,UEINT) <= 0.) {
// Note that we must take the delta against the (rho e) from
// before the floor is applied, so we hold on to it rather than
// relying on the order of the two writes below.
const amrex::Real rhoe_old = S(i, j, k, UEINT);

EOS::RTY2E(rho,small_T,massfrac,e_out);
S(i, j, k, UEINT) = rho * e_out;

if (l_dual_energy_update_E_from_e == 1) {
S(i, j, k, UEDEN) += (rho * e_out - S(i,j,k,UEINT));
S(i, j, k, UEDEN) += (rho * e_out - rhoe_old);
}
}
}
Expand Down
Loading