Skip to content

Commit

Permalink
update pressure scaling with area and coarse volume
Browse files Browse the repository at this point in the history
  • Loading branch information
zhichen3 committed Nov 12, 2024
1 parent a9dfeaa commit ebb142c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
22 changes: 2 additions & 20 deletions Source/driver/Castro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2875,12 +2875,9 @@ Castro::reflux (int crse_level, int fine_level, bool in_post_timestep)

reg = &getLevel(lev).pres_reg;

MultiFab dr(crse_lev.grids, crse_lev.dmap, 1, 0);
dr.setVal(crse_lev.geom.CellSize(0));

reg->ClearInternalBorders(crse_lev.geom);

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

if (update_sources_after_reflux || !in_post_timestep) {

Expand Down Expand Up @@ -2912,24 +2909,9 @@ Castro::reflux (int crse_level, int fine_level, bool in_post_timestep)

reg = &getLevel(lev).pres_reg;

MultiFab rdtheta(crse_lev.grids, crse_lev.dmap, 1, 0);

const auto* problo = Geom().ProbLo();
auto dr = crse_lev.geom.CellSize(0);
auto dtheta = crse_lev.geom.CellSize(1);

auto const& ma = rdtheta.arrays();

amrex::ParallelFor(rdtheta,
[=] AMREX_GPU_DEVICE (int b, int i, int j, int k) noexcept
{
Real r = problo[0] + static_cast<Real>(i + 0.5_rt) * dr;
ma[b](i,j,k) = r * dtheta;
});

reg->ClearInternalBorders(crse_lev.geom);

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

if (update_sources_after_reflux || !in_post_timestep) {

Expand Down
4 changes: 2 additions & 2 deletions Source/hydro/Castro_ctu_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ 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
Expand All @@ -1303,7 +1303,7 @@ 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
{
ptheta_fab(i,j,k) = qey_arr(i,j,k,GDPRES) * dt;
ptheta_fab(i,j,k) = area_arr(i,j,k) * qey_arr(i,j,k,GDPRES) * dt;
});
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/hydro/Castro_mol_hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
amrex::ParallelFor(nbx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
pradial_fab(i,j,k) = qex_fab(i,j,k,GDPRES) * dt;
pradial_fab(i,j,k) = area_arr(i,j,k) * qex_fab(i,j,k,GDPRES) * dt;
});
}
#endif
Expand All @@ -709,7 +709,7 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update)
amrex::ParallelFor(nbx,
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
ptheta_fab(i,j,k) = qey_fab(i,j,k,GDPRES) * dt;
ptheta_fab(i,j,k) = area_arr(i,j,k) * qey_fab(i,j,k,GDPRES) * dt;
});
}
#endif
Expand Down

0 comments on commit ebb142c

Please sign in to comment.