Skip to content

Commit

Permalink
try again fix gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Sep 19, 2024
1 parent dc707fd commit e187c15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
15 changes: 5 additions & 10 deletions Source/driver/timestep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Castro::estdt_cfl (int is_new)
// Courant-condition limited timestep

const auto dx = geom.CellSizeArray();
const auto problo = geom.ProbLoArray();

const MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type);

Expand Down Expand Up @@ -86,7 +85,7 @@ Castro::estdt_cfl (int is_new)
if (geom.IsSPHERICAL()) {
// dx[1] in Spherical2D is just dtheta, need rdtheta for physical length
// so just multiply by the smallest r
dt2 *= problo[0] + 0.5_rt * dx[0];
dt2 *= geom.ProbLoArray()[0] + 0.5_rt * dx[0];
}
#else
dt2 = dt1;
Expand Down Expand Up @@ -133,7 +132,6 @@ Castro::estdt_mhd (int is_new)

// MHD timestep limiter
const auto dx = geom.CellSizeArray();
const auto problo = geom.ProbLoArray();

const MultiFab& U_state = is_new ? get_new_data(State_Type) : get_old_data(State_Type);

Expand Down Expand Up @@ -214,7 +212,7 @@ Castro::estdt_mhd (int is_new)
#if AMREX_SPACEDIM >= 2
dt2 = dx[1]/(cy + std::abs(uy));
if (geom.IsSPHERICAL()) {
dt2 *= problo[0] + 0.5_rt * dx[0];
dt2 *= geom.ProbLoArray()[0] + 0.5_rt * dx[0];
}
#else
dt2 = dt1;
Expand Down Expand Up @@ -248,7 +246,6 @@ Castro::estdt_temp_diffusion (int is_new)
// where D = k/(rho c_v), and k is the conductivity

const auto dx = geom.CellSizeArray();
const auto problo = geom.ProbLoArray();

const MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type);

Expand Down Expand Up @@ -299,7 +296,7 @@ Castro::estdt_temp_diffusion (int is_new)
#if AMREX_SPACEDIM >= 2
dt2 = 0.5_rt * dx[1]*dx[1] / D;
if (geom.IsSPHERICAL()) {
Real r = problo[0] + 0.5_rt * dx[0];
Real r = geom.ProbLoArray()[0] + 0.5_rt * dx[0];
dt2 *= r * r;
}
#else
Expand Down Expand Up @@ -335,7 +332,6 @@ Castro::estdt_burning (int is_new)
}

const auto dx = geom.CellSizeArray();
const auto problo = geom.ProbLoArray();

MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type);

Expand Down Expand Up @@ -387,7 +383,7 @@ Castro::estdt_burning (int is_new)
Real r = 1.0_rt;
#if AMREX_SPACEDIM >= 2
if (geom.IsSPHERICAL()) {
r = problo[0] + 0.5_rt * dx[0];
r = geom.ProbLoArray()[0] + 0.5_rt * dx[0];
}
#endif
burn_state.dx = amrex::min(AMREX_D_DECL(dx[0], r * dx[1], dx[2]));
Expand Down Expand Up @@ -486,7 +482,6 @@ Real
Castro::estdt_rad (int is_new)
{
auto dx = geom.CellSizeArray();
const auto problo = geom.ProbLoArray();

const MultiFab& stateMF = is_new ? get_new_data(State_Type) : get_old_data(State_Type);
const MultiFab& radMF = is_new ? get_new_data(Rad_Type) : get_old_data(Rad_Type);
Expand Down Expand Up @@ -547,7 +542,7 @@ Castro::estdt_rad (int is_new)
#if AMREX_SPACEDIM >= 2
Real dt2 = dx[1] / (c + std::abs(uy));
if (geom.IsSPHERICAL()) {
dt2 *= problo[0] + 0.5_rt * dx[0];
dt2 *= geom.ProbLoArray()[0] + 0.5_rt * dx[0];
}
#else
Real dt2 = std::numeric_limits<Real>::max();
Expand Down
3 changes: 1 addition & 2 deletions Source/hydro/Castro_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ Castro::check_for_cfl_violation(const MultiFab& State, const Real dt)
int cfl_violation = 0;

auto dx = geom.CellSizeArray();
const auto problo = geom.ProbLoArray();

Real dtdx = dt / dx[0];

Expand All @@ -247,7 +246,7 @@ Castro::check_for_cfl_violation(const MultiFab& State, const Real dt)
if (geom.IsSPHERICAL()) {
// dx[1] in Spherical2D is just rdtheta, need rdtheta for physical length
// Just choose to divide by the smallest r
dtdy /= problo[0] + 0.5_rt * dx[0];
dtdy /= geom.ProbLoArray()[0] + 0.5_rt * dx[0];
}
}

Expand Down

0 comments on commit e187c15

Please sign in to comment.