Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use amrex prefix #154

Merged
merged 1 commit into from
Jan 21, 2024
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
58 changes: 29 additions & 29 deletions Source/Diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,14 +990,14 @@ Diffusion::diffuse_Vsync (MultiFab& Vsync,

for (int k = 0; k < AMREX_SPACEDIM; k++)
{
if (velbc.hi(k) == EXT_DIR)
if (velbc.hi(k) == BCType::ext_dir)
{
IntVect smallend = domain.smallEnd();
smallend.setVal(k,domain.bigEnd(k));
Box top_strip(smallend,domain.bigEnd(),IntVect::TheCellVector());
Vsync.setVal(0,top_strip,n-Xvel,1,1);
}
if (velbc.lo(k) == EXT_DIR)
if (velbc.lo(k) == BCType::ext_dir)
{
IntVect bigend = domain.bigEnd();
bigend.setVal(k,domain.smallEnd(k));
Expand Down Expand Up @@ -1488,15 +1488,15 @@ Diffusion::computeExtensiveFluxes(MLMG& a_mg, MultiFab& Soln,
#endif
for (MFIter mfi(Soln, mfi_info); mfi.isValid(); ++mfi)
{
D_TERM( const auto& fx = flxx.array(mfi);,
AMREX_D_TERM( const auto& fx = flxx.array(mfi);,
const auto& fy = flxy.array(mfi);,
const auto& fz = flxz.array(mfi););

D_TERM( const Box ubx = mfi.nodaltilebox(0);,
AMREX_D_TERM( const Box ubx = mfi.nodaltilebox(0);,
const Box vbx = mfi.nodaltilebox(1);,
const Box wbx = mfi.nodaltilebox(2););

D_TERM( const auto& areax = area[0].array(mfi);,
AMREX_D_TERM( const auto& areax = area[0].array(mfi);,
const auto& areay = area[1].array(mfi);,
const auto& areaz = area[2].array(mfi););

Expand All @@ -1512,24 +1512,24 @@ Diffusion::computeExtensiveFluxes(MLMG& a_mg, MultiFab& Soln,
// For now, set to very large num so we know if you accidentally use it
// MLMG will set covered fluxes to zero
//
D_TERM(AMREX_PARALLEL_FOR_4D(ubx, ncomp, i, j, k, n, {fx(i,j,k,n) = COVERED_VAL;});,
AMREX_D_TERM(AMREX_PARALLEL_FOR_4D(ubx, ncomp, i, j, k, n, {fx(i,j,k,n) = COVERED_VAL;});,
AMREX_PARALLEL_FOR_4D(vbx, ncomp, i, j, k, n, {fy(i,j,k,n) = COVERED_VAL;});,
AMREX_PARALLEL_FOR_4D(wbx, ncomp, i, j, k, n, {fz(i,j,k,n) = COVERED_VAL;}););
}
else if ( flags.getType(amrex::grow(bx,0)) != FabType::regular )
{
D_TERM( const auto& afrac_x = areafrac[0]->array(mfi);,
AMREX_D_TERM( const auto& afrac_x = areafrac[0]->array(mfi);,
const auto& afrac_y = areafrac[1]->array(mfi);,
const auto& afrac_z = areafrac[2]->array(mfi););

D_TERM(AMREX_PARALLEL_FOR_4D(ubx, ncomp, i, j, k, n, {fx(i,j,k,n) *= fac*areax(i,j,k)*afrac_x(i,j,k);});,
AMREX_D_TERM(AMREX_PARALLEL_FOR_4D(ubx, ncomp, i, j, k, n, {fx(i,j,k,n) *= fac*areax(i,j,k)*afrac_x(i,j,k);});,
AMREX_PARALLEL_FOR_4D(vbx, ncomp, i, j, k, n, {fy(i,j,k,n) *= fac*areay(i,j,k)*afrac_y(i,j,k);});,
AMREX_PARALLEL_FOR_4D(wbx, ncomp, i, j, k, n, {fz(i,j,k,n) *= fac*areaz(i,j,k)*afrac_z(i,j,k);}););
}
else
#endif
{
D_TERM(AMREX_PARALLEL_FOR_4D(ubx, ncomp, i, j, k, n, {fx(i,j,k,n) *= fac*areax(i,j,k);});,
AMREX_D_TERM(AMREX_PARALLEL_FOR_4D(ubx, ncomp, i, j, k, n, {fx(i,j,k,n) *= fac*areax(i,j,k);});,
AMREX_PARALLEL_FOR_4D(vbx, ncomp, i, j, k, n, {fy(i,j,k,n) *= fac*areay(i,j,k);});,
AMREX_PARALLEL_FOR_4D(wbx, ncomp, i, j, k, n, {fz(i,j,k,n) *= fac*areaz(i,j,k);}););
}
Expand Down Expand Up @@ -1898,17 +1898,17 @@ Diffusion::setDomainBC (std::array<LinOpBCType,AMREX_SPACEDIM>& mlmg_lobc,
else
{
int pbc = bc.lo(idim);
if (pbc == EXT_DIR)
if (pbc == BCType::ext_dir)
{
mlmg_lobc[idim] = LinOpBCType::Dirichlet;
}
else if (pbc == FOEXTRAP ||
pbc == HOEXTRAP ||
pbc == REFLECT_EVEN)
else if (pbc == BCType::foextrap ||
pbc == BCType::hoextrap ||
pbc == BCType::reflect_even)
{
mlmg_lobc[idim] = LinOpBCType::Neumann;
}
else if (pbc == REFLECT_ODD)
else if (pbc == BCType::reflect_odd)
{
mlmg_lobc[idim] = LinOpBCType::reflect_odd;
}
Expand All @@ -1918,17 +1918,17 @@ Diffusion::setDomainBC (std::array<LinOpBCType,AMREX_SPACEDIM>& mlmg_lobc,
}

pbc = bc.hi(idim);
if (pbc == EXT_DIR)
if (pbc == BCType::ext_dir)
{
mlmg_hibc[idim] = LinOpBCType::Dirichlet;
}
else if (pbc == FOEXTRAP ||
pbc == HOEXTRAP ||
pbc == REFLECT_EVEN)
else if (pbc == BCType::foextrap ||
pbc == BCType::hoextrap ||
pbc == BCType::reflect_even)
{
mlmg_hibc[idim] = LinOpBCType::Neumann;
}
else if (pbc == REFLECT_ODD)
else if (pbc == BCType::reflect_odd)
{
mlmg_hibc[idim] = LinOpBCType::reflect_odd;
}
Expand Down Expand Up @@ -1956,17 +1956,17 @@ Diffusion::setDomainBC (std::array<LinOpBCType,AMREX_SPACEDIM>& mlmg_lobc,
else
{
int pbc = bc.lo(idim);
if (pbc == EXT_DIR)
if (pbc == BCType::ext_dir)
{
mlmg_lobc[idim] = LinOpBCType::Dirichlet;
}
else if (pbc == FOEXTRAP ||
pbc == HOEXTRAP ||
pbc == REFLECT_EVEN)
else if (pbc == BCType::foextrap ||
pbc == BCType::hoextrap ||
pbc == BCType::reflect_even)
{
mlmg_lobc[idim] = LinOpBCType::Neumann;
}
else if (pbc == REFLECT_ODD)
else if (pbc == BCType::reflect_odd)
{
mlmg_lobc[idim] = LinOpBCType::reflect_odd;
}
Expand All @@ -1976,17 +1976,17 @@ Diffusion::setDomainBC (std::array<LinOpBCType,AMREX_SPACEDIM>& mlmg_lobc,
}

pbc = bc.hi(idim);
if (pbc == EXT_DIR)
if (pbc == BCType::ext_dir)
{
mlmg_hibc[idim] = LinOpBCType::Dirichlet;
}
else if (pbc == FOEXTRAP ||
pbc == HOEXTRAP ||
pbc == REFLECT_EVEN)
else if (pbc == BCType::foextrap ||
pbc == BCType::hoextrap ||
pbc == BCType::reflect_even)
{
mlmg_hibc[idim] = LinOpBCType::Neumann;
}
else if (pbc == REFLECT_ODD)
else if (pbc == BCType::reflect_odd)
{
mlmg_hibc[idim] = LinOpBCType::reflect_odd;
}
Expand Down
14 changes: 7 additions & 7 deletions Source/MacProj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,19 +805,19 @@ MacProj::check_div_cond (int level,
{
const Box& bx = mfi.tilebox();
auto const& cc_divu = dmac.array(mfi);
D_TERM(auto const& ux_e = U_edge[0].array(mfi);,
AMREX_D_TERM(auto const& ux_e = U_edge[0].array(mfi);,
auto const& uy_e = U_edge[1].array(mfi);,
auto const& uz_e = U_edge[2].array(mfi););
D_TERM(auto const& xarea = area[0].array(mfi);,
AMREX_D_TERM(auto const& xarea = area[0].array(mfi);,
auto const& yarea = area[1].array(mfi);,
auto const& zarea = area[2].array(mfi););
auto const& vol = volume.array(mfi);

amrex::ParallelFor(bx, [cc_divu,D_DECL(ux_e,uy_e,uz_e),
D_DECL(xarea,yarea,zarea), vol]
amrex::ParallelFor(bx, [cc_divu,AMREX_D_DECL(ux_e,uy_e,uz_e),
AMREX_D_DECL(xarea,yarea,zarea), vol]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
cc_divu(i,j,k) = D_TERM( xarea(i+1,j,k)*ux_e(i+1,j,k) - xarea(i,j,k)*ux_e(i,j,k),
cc_divu(i,j,k) = AMREX_D_TERM( xarea(i+1,j,k)*ux_e(i+1,j,k) - xarea(i,j,k)*ux_e(i,j,k),
+ yarea(i,j+1,k)*uy_e(i,j+1,k) - yarea(i,j,k)*uy_e(i,j,k),
+ zarea(i,j,k+1)*uz_e(i,j,k+1) - zarea(i,j,k)*uz_e(i,j,k));
cc_divu(i,j,k) /= vol(i,j,k);
Expand Down Expand Up @@ -1193,12 +1193,12 @@ MacProj::set_mac_solve_bc (Array<MLLinOp::BCType,AMREX_SPACEDIM>& mlmg_lobc,
mlmg_lobc[idim] = MLLinOp::BCType::Periodic;
mlmg_hibc[idim] = MLLinOp::BCType::Periodic;
} else {
if (a_phys_bc.lo(idim) == Outflow) {
if (a_phys_bc.lo(idim) == PhysBCType::outflow) {
mlmg_lobc[idim] = MLLinOp::BCType::Dirichlet;
} else {
mlmg_lobc[idim] = MLLinOp::BCType::Neumann;
}
if (a_phys_bc.hi(idim) == Outflow) {
if (a_phys_bc.hi(idim) == PhysBCType::outflow) {
mlmg_hibc[idim] = MLLinOp::BCType::Dirichlet;
} else {
mlmg_hibc[idim] = MLLinOp::BCType::Neumann;
Expand Down
21 changes: 11 additions & 10 deletions Source/NS_BC.H
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
#include <RegType.H>
#include <AMReX_BC_TYPES.H>

//
// Components are Interior, Inflow, Outflow, Symmetry, SlipWall, NoSlipWall.
//
static int norm_vel_bc[] =
{
INT_DIR, EXT_DIR, FOEXTRAP, REFLECT_ODD, EXT_DIR, EXT_DIR
amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_odd, amrex::BCType::ext_dir, amrex::BCType::ext_dir
};

static int tang_vel_bc[] =
{
INT_DIR, EXT_DIR, FOEXTRAP, REFLECT_EVEN, HOEXTRAP, EXT_DIR
amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::hoextrap, amrex::BCType::ext_dir
};

static int scalar_bc[] =
{
INT_DIR, EXT_DIR, FOEXTRAP, REFLECT_EVEN, FOEXTRAP, FOEXTRAP
amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::foextrap, amrex::BCType::foextrap
};

static int press_bc[] =
{
INT_DIR, FOEXTRAP, FOEXTRAP, REFLECT_EVEN, FOEXTRAP, FOEXTRAP
amrex::BCType::int_dir, amrex::BCType::foextrap, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::foextrap, amrex::BCType::foextrap
};

static int norm_gradp_bc[] =
{
INT_DIR, FOEXTRAP, FOEXTRAP, REFLECT_ODD, FOEXTRAP, FOEXTRAP
amrex::BCType::int_dir, amrex::BCType::foextrap, amrex::BCType::foextrap, amrex::BCType::reflect_odd, amrex::BCType::foextrap, amrex::BCType::foextrap
};

static int tang_gradp_bc[] =
{
INT_DIR, FOEXTRAP, FOEXTRAP, REFLECT_EVEN, FOEXTRAP, FOEXTRAP
amrex::BCType::int_dir, amrex::BCType::foextrap, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::foextrap, amrex::BCType::foextrap
};

static int temp_bc[] =
{
INT_DIR, EXT_DIR, HOEXTRAP, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN
amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::hoextrap, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even
};

static int divu_bc[] =
{
INT_DIR, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN
amrex::BCType::int_dir, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even
};

static int dsdt_bc[] =
{
INT_DIR, EXT_DIR, EXT_DIR, REFLECT_EVEN, REFLECT_EVEN, REFLECT_EVEN
amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::ext_dir, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even
};

static int average_bc[] =
{
INT_DIR, INT_DIR, INT_DIR, INT_DIR, INT_DIR, INT_DIR
amrex::BCType::int_dir, amrex::BCType::int_dir, amrex::BCType::int_dir, amrex::BCType::int_dir, amrex::BCType::int_dir, amrex::BCType::int_dir
};
20 changes: 10 additions & 10 deletions Source/NS_LES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,17 @@ NavierStokesBase::LES_setDomainBC (std::array<LinOpBCType,AMREX_SPACEDIM>& mlmg_
else
{
int pbc = bc.lo(idim);
if (pbc == EXT_DIR)
if (pbc == BCType::ext_dir)
{
mlmg_lobc[idim] = LinOpBCType::Dirichlet;
}
else if (pbc == FOEXTRAP ||
pbc == HOEXTRAP ||
pbc == REFLECT_EVEN)
else if (pbc == BCType::foextrap ||
pbc == BCType::hoextrap ||
pbc == BCType::reflect_even)
{
mlmg_lobc[idim] = LinOpBCType::Neumann;
}
else if (pbc == REFLECT_ODD)
else if (pbc == BCType::reflect_odd)
{
mlmg_lobc[idim] = LinOpBCType::reflect_odd;
}
Expand All @@ -262,17 +262,17 @@ NavierStokesBase::LES_setDomainBC (std::array<LinOpBCType,AMREX_SPACEDIM>& mlmg_
}

pbc = bc.hi(idim);
if (pbc == EXT_DIR)
if (pbc == BCType::ext_dir)
{
mlmg_hibc[idim] = LinOpBCType::Dirichlet;
}
else if (pbc == FOEXTRAP ||
pbc == HOEXTRAP ||
pbc == REFLECT_EVEN)
else if (pbc == BCType::foextrap ||
pbc == BCType::hoextrap ||
pbc == BCType::reflect_even)
{
mlmg_hibc[idim] = LinOpBCType::Neumann;
}
else if (pbc == REFLECT_ODD)
else if (pbc == BCType::reflect_odd)
{
mlmg_hibc[idim] = LinOpBCType::reflect_odd;
}
Expand Down
Loading