Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eebasso committed Nov 20, 2023
1 parent c469bf6 commit dc5eb67
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions Src/LinearSolvers/MLMG/AMReX_MLCellABecLap.H
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@ MLCellABecLapT<MF>::getFluxes (const Vector<Array<MF*,AMREX_SPACEDIM> >& a_flux,
BL_PROFILE("MLMG::getFluxes()");

const int ncomp = this->getNComp();
const RT betainv = RT(1.0) / getBScalar();
const RT bscalarinv = RT(1.0) / getBScalar();
const int nlevs = this->NAMRLevels();
for (int alev = 0; alev < nlevs; ++alev) {
this->compFlux(alev, a_flux[alev], *a_sol[alev], a_loc);
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
this->unapplyMetricTerm(alev, 0, *a_flux[alev][idim]);
if (betainv != RT(1.0)) {
a_flux[alev][idim]->mult(betainv, 0, ncomp);
if (bscalarinv != RT(1.0)) {
a_flux[alev][idim]->mult(bscalarinv, 0, ncomp);
}
}
this->addInhomogNeumannFlux(alev, a_flux[alev], *a_sol[alev], true);
Expand Down Expand Up @@ -292,7 +292,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
const RT dx = static_cast<RT>(this->m_geom[amrlev][mglev].CellSize(0));
const Box& domain = this->m_geom[amrlev][mglev].Domain();

const RT beta = getBScalar();
const RT bscalar = getBScalar();
Array<MF const*, AMREX_SPACEDIM> const& bcoef = getBCoeffs(amrlev,mglev);
FAB foo(Box(IntVect(0),IntVect(1)));
bool has_bcoef = (bcoef[0] != nullptr);
Expand Down Expand Up @@ -338,7 +338,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
if (this->m_lobc_orig[icomp][idim] == LinOpBCType::inhomogNeumann && outside_domain_lo)
{
if (idim == 0) {
RT fac = beta*dxi;
RT fac = bscalar*dxi;
if (this->m_has_metric_term && !has_bcoef) {
#if (AMREX_SPACEDIM == 1)
fac *= static_cast<RT>(problo[0]*problo[0]);
Expand All @@ -353,7 +353,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
fac, has_bcoef, icomp);
});
} else if (idim == 1) {
RT fac = beta*dyi;
RT fac = bscalar*dyi;
if (this->m_has_metric_term && !has_bcoef) {
AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
{
Expand All @@ -371,7 +371,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
});
}
} else {
RT fac = beta*dzi;
RT fac = bscalar*dzi;
AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
{
mllinop_apply_innu_zlo(i,j,k, rhsfab, mlo, bfab,
Expand All @@ -383,7 +383,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
if (this->m_hibc_orig[icomp][idim] == LinOpBCType::inhomogNeumann && outside_domain_hi)
{
if (idim == 0) {
RT fac = beta*dxi;
RT fac = bscalar*dxi;
if (this->m_has_metric_term && !has_bcoef) {
#if (AMREX_SPACEDIM == 1)
fac *= static_cast<RT>(probhi[0]*probhi[0]);
Expand All @@ -398,7 +398,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
fac, has_bcoef, icomp);
});
} else if (idim == 1) {
RT fac = beta*dyi;
RT fac = bscalar*dyi;
if (this->m_has_metric_term && !has_bcoef) {
AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
{
Expand All @@ -415,7 +415,7 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
});
}
} else {
RT fac = beta*dzi;
RT fac = bscalar*dzi;
AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
{
mllinop_apply_innu_zhi(i,j,k, rhsfab, mhi, bfab,
Expand All @@ -432,23 +432,23 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
if (this->m_lobc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_lo)
{
if (idim == 0) {
RT fac = beta*dxi*dxi;
RT fac = bscalar*dxi*dxi;
AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
{
RT A = rbc(i,j,k,2)
/ (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*RT(0.5));
rhsfab(i+1,j,k,icomp) += fac*bfab(i+1,j,k,icomp)*A;
});
} else if (idim == 1) {
RT fac = beta*dyi*dyi;
RT fac = bscalar*dyi*dyi;
AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
{
RT A = rbc(i,j,k,2)
/ (rbc(i,j,k,1)*dyi + rbc(i,j,k,0)*RT(0.5));
rhsfab(i,j+1,k,icomp) += fac*bfab(i,j+1,k,icomp)*A;
});
} else {
RT fac = beta*dzi*dzi;
RT fac = bscalar*dzi*dzi;
AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
{
RT A = rbc(i,j,k,2)
Expand All @@ -460,23 +460,23 @@ MLCellABecLapT<MF>::applyInhomogNeumannTerm (int amrlev, MF& rhs) const
if (this->m_hibc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_hi)
{
if (idim == 0) {
RT fac = beta*dxi*dxi;
RT fac = bscalar*dxi*dxi;
AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
{
RT A = rbc(i,j,k,2)
/ (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*RT(0.5));
rhsfab(i-1,j,k,icomp) += fac*bfab(i,j,k,icomp)*A;
});
} else if (idim == 1) {
RT fac = beta*dyi*dyi;
RT fac = bscalar*dyi*dyi;
AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
{
RT A = rbc(i,j,k,2)
/ (rbc(i,j,k,1)*dyi + rbc(i,j,k,0)*RT(0.5));
rhsfab(i,j-1,k,icomp) += fac*bfab(i,j,k,icomp)*A;
});
} else {
RT fac = beta*dzi*dzi;
RT fac = bscalar*dzi*dzi;
AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
{
RT A = rbc(i,j,k,2)
Expand Down
2 changes: 1 addition & 1 deletion Src/LinearSolvers/MLMG/AMReX_MLMG.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public:
Location a_loc = Location::FaceCenter);

/**
* \brief For ``(alpha * a - beta * (del dot b grad)) phi = rhs``, flux means ``-b grad phi``
* \brief For ``(A * alpha - B * (del dot beta grad)) phi = rhs``, flux means ``-beta grad phi``
*/
template <typename AMF>
void getFluxes (const Vector<Array<AMF*,AMREX_SPACEDIM> >& a_flux,
Expand Down
2 changes: 1 addition & 1 deletion Src/LinearSolvers/MLMG/AMReX_MLNodeABecLaplacian.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace amrex {

// (A * alpha - B * (del dot beta grad)) phi = rhs
// a, phi and rhs are nodal. b is cell-centered.
// alpha, phi and rhs are nodal. beta is cell-centered.
class MLNodeABecLaplacian
: public MLNodeLinOp
{
Expand Down

0 comments on commit dc5eb67

Please sign in to comment.