Skip to content

Commit

Permalink
cleaning up MultiFab::Multiply calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mbkuhn committed Aug 21, 2024
1 parent ba13062 commit e572c17
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 41 deletions.
36 changes: 13 additions & 23 deletions amr-wind/equation_systems/icns/icns_advection.H
Original file line number Diff line number Diff line change
Expand Up @@ -282,31 +282,21 @@ struct AdvectionOp<ICNS, fvm::Godunov>

// Calculate fluxes using momentum directly
if (!mphase_vof) {
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, 0, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, 1, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, 2, 1, fvm::Godunov::nghost_state);
// Source terms are at old state during calculation of advection
// terms
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, 0, 1, fvm::Godunov::nghost_src);
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, 1, 1, fvm::Godunov::nghost_src);
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, 2, 1, fvm::Godunov::nghost_src);

// Ensure rho_nph is up-to-date and multiply for correct
// boundaries
// Ensure rho_nph is up-to-date
rho_nph.fillphysbc(
lev, time + 0.5 * dt, rho_nph(lev), rho_nph.num_grow());
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, 0, 1, fvm::Godunov::nghost_src);
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, 1, 1, fvm::Godunov::nghost_src);
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, 2, 1, fvm::Godunov::nghost_src);

for (int idim = 0; idim < dof_field.num_comp(); ++idim) {
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, idim, 1, fvm::Godunov::nghost_state);
// Source terms at old state during advection calculation
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, idim, 1, fvm::Godunov::nghost_src);

amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, idim, 1,
fvm::Godunov::nghost_src);
}
}

amrex::MFItInfo mfi_info;
Expand Down
28 changes: 10 additions & 18 deletions amr-wind/equation_systems/vof/vof_momentum_flux.H
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,12 @@ static void hybrid_fluxes(
amrex::MultiFab::Copy(
fq, src_term(lev), 0, 0, ncomp, fvm::Godunov::nghost_src);

amrex::MultiFab::Multiply(
q, rho_o(lev), 0, 0, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, 1, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, 2, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, 0, 1, fvm::Godunov::nghost_src);
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, 1, 1, fvm::Godunov::nghost_src);
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, 2, 1, fvm::Godunov::nghost_src);
for (int idim = 0; idim < dof_field.num_comp(); ++idim) {
amrex::MultiFab::Multiply(
q, rho_o(lev), 0, idim, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
fq, rho_o(lev), 0, idim, 1, fvm::Godunov::nghost_src);
}

amrex::MultiFab frho(
src_term(lev).boxArray(), src_term(lev).DistributionMap(), 1,
Expand All @@ -96,12 +90,10 @@ static void hybrid_fluxes(
dof_field.fillphysbc(lev, time + 0.5 * dt, q_nph, dof_field.num_grow());
// Density at NPH is fully calculated a priori
// Multiply to get momentum at NPH
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, 0, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, 1, 1, fvm::Godunov::nghost_state);
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, 2, 1, fvm::Godunov::nghost_state);
for (int idim = 0; idim < dof_field.num_comp(); ++idim) {
amrex::MultiFab::Multiply(
q_nph, rho_nph(lev), 0, idim, 1, fvm::Godunov::nghost_state);
}

std::string advection_type = "Godunov";
int limiter_type = PPM::UPWIND; // default
Expand Down

0 comments on commit e572c17

Please sign in to comment.