Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/AMReX-Codes/amrex in…
Browse files Browse the repository at this point in the history
…to comments-scalar-terminology
  • Loading branch information
eebasso committed Nov 29, 2023
2 parents c05db53 + 4b64003 commit de8e3a0
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 82 deletions.
6 changes: 3 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

-- We weren't defining cent_hat out far enough (#3548)

-- Add Fortran inteface for FillCoarsePatch for face variables (#3542)
-- Add Fortran interface for FillCoarsePatch for face variables (#3542)

-- print_state/printCell: Make it work without managed memory (#3543)

Expand Down Expand Up @@ -114,7 +114,7 @@

-- Simplify filterParticles Kernel (#3510)

-- Generatize particle-to-cell assignment function (#3499)
-- Generalize particle-to-cell assignment function (#3499)
Follow-on to 3499 (#3514)
ParticleLocator: Make Assignor optional template parameter (#3515)

Expand Down Expand Up @@ -302,7 +302,7 @@

# 23.07

-- Allow users to change the default vector growth stategy (#3389)
-- Allow users to change the default vector growth strategy (#3389)

-- Communications arena implementation (#3388)

Expand Down
8 changes: 4 additions & 4 deletions Src/AmrCore/AMReX_FillPatcher.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace amrex {
* with interpolation of the coarse data. Then it fills the fine ghost
* cells overlapping fine level valid cells with the fine level data. If
* the valid cells of the destination need to be filled, it will be done as
* well. Finally, it will fill the physical bounbary using the user
* well. Finally, it will fill the physical boundary using the user
* provided functor. The `fill` member function can be used to do the
* operations just described. Alternatively, one can also use the
* `fillCoarseFineBounary` to fill the ghost cells at the coarse/fine
* boundary only. Then one can manually call FillBoundary to fill the other
* ghost cells, and use the physical BC functor to handle the physical
* boundeary.
* boundary.
*
* The communication of the coarse data needed for spatial interpolation is
* optimized at the cost of being error-prone. One must follow the
Expand All @@ -42,7 +42,7 @@ namespace amrex {
*
* (3) When to destroy? Usually, we do time steppig on a coarse level
* first. Then we recursively do time stepping on fine levels. After the
* finer level finishes, we do reflux and averge the fine data down to the
* finer level finishes, we do reflux and average the fine data down to the
* coarse level. After that we should destroy the FillPatcher object
* associated with these two levels, because the coarse data stored in the
* object has become outdated. For AmrCore based codes, you could use
Expand Down Expand Up @@ -118,7 +118,7 @@ public:
* \param fbc for filling fine level physical BC
* \param fbccomp starting component of the fine level BC functor
* \param bcs BCRec specifying physical boundary types
* \parame bcscomp starting component of the BCRec Vector.
* \param bcscomp starting component of the BCRec Vector.
* \param pre_interp optional pre-interpolation hook for modifying the coarse data
* \param post_interp optional post-interpolation hook for modifying the fine data
*/
Expand Down
4 changes: 2 additions & 2 deletions Src/AmrCore/AMReX_InterpFaceRegister.H
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace amrex {

/**
* \brief InterpFaceRegister is a coarse/fine boundary register for
* interpolation of face data at the coarse/fine boundadry.
* interpolation of face data at the coarse/fine boundary.
*/

class InterpFaceRegister
Expand All @@ -31,7 +31,7 @@ public:
Geometry const& fgeom, IntVect const& ref_ratio);

/**
* \brief Defines an InterpFaceRegister objecct.
* \brief Defines an InterpFaceRegister object.
*
* \param fba The fine level BoxArray
* \param fdm The fine level DistributionMapping
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_BCRec.H
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public:
{}
/*
* \brief Yet another constructor. Inherits bndry types from bc_domain
* when bx lies on edge of domain otherwise gets interior Dirchlet.
* when bx lies on edge of domain otherwise gets interior Dirichlet.
*/
AMREX_GPU_HOST_DEVICE
BCRec (const Box& bx,
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_FArrayBox.H
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public:
* \brief Pure virtual function. Derived classes MUST override this
* function to skip over the next FAB f in the istream, under the
* assumption that the header for the FAB f has already been
* skpped over.
* skipped over.
*/
virtual void skip (std::istream& is,
FArrayBox& f) const = 0;
Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX_FabArray.H
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public:

/**
* \brief Construct an empty FabArray<FAB> that has a default Arena. If
* `define` is called later with a nulltpr as MFInfo's arena, the
* `define` is called later with a nullptr as MFInfo's arena, the
* default Arena `a` will be used. If the arena in MFInfo is not a
* nullptr, the MFInfo's arena will be used.
*/
Expand Down Expand Up @@ -2827,7 +2827,7 @@ template <class FAB>
void
FabArray<FAB>::shift (const IntVect& v)
{
clearThisBD(); // The new boxarry will have a different ID.
clearThisBD(); // The new boxarray will have a different ID.
boxarray.shift(v);
addThisBD();
#ifdef AMREX_USE_OMP
Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX_MultiFab.H
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public:
/**
* \brief Constructs an empty MultiFab. Data can be defined at a later
* time using the define member functions inherited from FabArray. If
* `define` is called later with a nulltpr as MFInfo's arena, the default
* `define` is called later with a nullptr as MFInfo's arena, the default
* Arena `a` will be used. If the arena in MFInfo is not a nullptr, the
* MFInfo's arena will be used.
*/
Expand All @@ -60,7 +60,7 @@ public:
* \brief
* Constructs a MultiFab
* \param bs a valid region
* \param dm a DistribuionMapping
* \param dm a DistributionMapping
* \param ncomp number of components
* \param ngrow number of cells the region grows
* \param info MFInfo
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_MultiFabUtil.H
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ namespace amrex
void FillRandom (MultiFab& mf, int scomp, int ncomp);

/**
* \brief Fill MultiFab with random numbers from nornmal distribution
* \brief Fill MultiFab with random numbers from normal distribution
*
* All cells including ghost cells are filled.
*
Expand Down
2 changes: 1 addition & 1 deletion Src/Base/AMReX_MultiFabUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ namespace amrex
auto tmptype = type;
tmptype.set(dir);
if (dir >= AMREX_SPACEDIM || !tmptype.nodeCentered()) {
amrex::Abort("average_down_edges: not face index type");
amrex::Abort("average_down_edges: not edge index type");
}
const int ncomp = crse.nComp();
if (isMFIterSafe(fine, crse))
Expand Down
4 changes: 2 additions & 2 deletions Src/Base/AMReX_iMultiFab.H
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace amrex {
* member functions are defined for I/O and simple arithmetic operations on
* these aggregate objects.
*
8 This class does NOT provide a copy constructor or assignment operator.
* This class does NOT provide a copy constructor or assignment operator.
*/
class iMultiFab
:
Expand All @@ -42,7 +42,7 @@ public:
/**
* \brief Constructs an empty iMultiFab. Data can be defined at a later
* time using the define member functions inherited from FabArray. If
* `define` is called later with a nulltpr as MFInfo's arena, the default
* `define` is called later with a nullptr as MFInfo's arena, the default
* Arena `a` will be used. If the arena in MFInfo is not a nullptr, the
* MFInfo's arena will be used.
*/
Expand Down
2 changes: 1 addition & 1 deletion Src/EB/AMReX_EB_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ facets_nearest_pt (IntVect const& ind_pt, IntVect const& ind_loop, RealVect cons
RealVect const& eb_normal, RealVect const& eb_p0,
GpuArray<Real,AMREX_SPACEDIM> const& dx)
{
// Enumerate the possible EB facet edges invovlved.
// Enumerate the possible EB facet edges involved.
int n_facets = 0;
IntVect ind_facets {AMREX_D_DECL(0, 0, 0)};
for (int d = 0; d < AMREX_SPACEDIM; ++d) {
Expand Down
2 changes: 1 addition & 1 deletion Src/F_Interfaces/Base/AMReX_parallel_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ subroutine amrex_parallel_init (comm)

if (present(comm) .and. .not.flag) then
if (comm .ne. MPI_COMM_WORLD) then
stop "MPI has not been initialized. How come we are given a communciator?"
stop "MPI has not been initialized. How come we are given a communicator?"
endif
end if

Expand Down
68 changes: 39 additions & 29 deletions Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public:

/**
* Sets alpha as a scalar field to values from a single component
* mutlifab.
* multifab.
*
* \param [in] amrlev The level of the multifab for the solver, with
* \p amrlev = 0 always being the lowest level in the
Expand All @@ -88,12 +88,12 @@ public:

/**
* Sets alpha as a single constant coefficient value across
* the mutlifab.
* the multifab.
*
* \param [in] amrlev The level of the multifab for the solver, with
* \p amrlev = 0 always being the lowest level in the
* AMR hierarchy represented in the solve.
* \param [in] alpha Single constant coefficient value to populate across mutlifab.
* \param [in] alpha Single constant coefficient value to populate across multifab.
*/
template <typename T,
std::enable_if_t<std::is_convertible_v<T,typename MF::value_type>,
Expand All @@ -118,12 +118,12 @@ public:

/**
* Sets beta as a single constant coefficient value across
* the mutlifabs (one for each dimension).
* the multifabs (one for each dimension).
*
* \param [in] amrlev The level of the multifab for the solver, with
* \p amrlev = 0 always being the lowest level in the
* AMR hierarchy represented in the solve.
* \param [in] beta Single constant coefficient value to populate across mutlifabs.
* \param [in] beta Single constant coefficient value to populate across multifabs.
*/
template <typename T,
std::enable_if_t<std::is_convertible_v<T,typename MF::value_type>,
Expand Down Expand Up @@ -190,15 +190,15 @@ public:
Array<FAB*,AMREX_SPACEDIM> const& flux,
FAB const& sol, int face_only, int ncomp);

protected:

bool m_needs_update = true;

RT m_a_scalar = std::numeric_limits<RT>::quiet_NaN();
RT m_b_scalar = std::numeric_limits<RT>::quiet_NaN();
Vector<Vector<MF> > m_a_coeffs;
Vector<Vector<Array<MF,AMREX_SPACEDIM> > > m_b_coeffs;

protected:

bool m_needs_update = true;

Vector<int> m_is_singular;

[[nodiscard]] bool supportRobinBC () const noexcept override { return true; }
Expand Down Expand Up @@ -474,29 +474,29 @@ MLABecLaplacianT<MF>::applyMetricTermsCoeffs ()
// \tilde{alpha}_i = alpha_i + (1-B) beta_{i+1/2} / h^2
// \tilde{rhs}_i = rhs_i + A beta_{i+1/2} / h^2
//
template <typename MF>
void
MLABecLaplacianT<MF>::applyRobinBCTermsCoeffs ()
namespace detail {
template <typename LP>
void applyRobinBCTermsCoeffs (LP& linop)
{
if (!(this->hasRobinBC())) { return; }
using RT = typename LP::RT;

const int ncomp = this->getNComp();
const int ncomp = linop.getNComp();
bool reset_alpha = false;
if (m_a_scalar == RT(0.0)) {
m_a_scalar = RT(1.0);
if (linop.m_a_scalar == RT(0.0)) {
linop.m_a_scalar = RT(1.0);
reset_alpha = true;
}
const RT bovera = m_b_scalar/m_a_scalar;
const RT bovera = linop.m_b_scalar/linop.m_a_scalar;

for (int amrlev = 0; amrlev < this->m_num_amr_levels; ++amrlev) {
for (int amrlev = 0; amrlev < linop.NAMRLevels(); ++amrlev) {
const int mglev = 0;
const Box& domain = this->m_geom[amrlev][mglev].Domain();
const RT dxi = static_cast<RT>(this->m_geom[amrlev][mglev].InvCellSize(0));
const RT dyi = static_cast<RT>((AMREX_SPACEDIM >= 2) ? this->m_geom[amrlev][mglev].InvCellSize(1) : Real(1.0));
const RT dzi = static_cast<RT>((AMREX_SPACEDIM == 3) ? this->m_geom[amrlev][mglev].InvCellSize(2) : Real(1.0));
const Box& domain = linop.Geom(amrlev,mglev).Domain();
const RT dxi = static_cast<RT>(linop.Geom(amrlev,mglev).InvCellSize(0));
const RT dyi = static_cast<RT>((AMREX_SPACEDIM >= 2) ? linop.Geom(amrlev,mglev).InvCellSize(1) : Real(1.0));
const RT dzi = static_cast<RT>((AMREX_SPACEDIM == 3) ? linop.Geom(amrlev,mglev).InvCellSize(2) : Real(1.0));

if (reset_alpha) {
m_a_coeffs[amrlev][mglev].setVal(RT(0.0));
linop.m_a_coeffs[amrlev][mglev].setVal(RT(0.0));
}

MFItInfo mfi_info;
Expand All @@ -505,20 +505,20 @@ MLABecLaplacianT<MF>::applyRobinBCTermsCoeffs ()
#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
for (MFIter mfi(m_a_coeffs[amrlev][mglev], mfi_info); mfi.isValid(); ++mfi)
for (MFIter mfi(linop.m_a_coeffs[amrlev][mglev], mfi_info); mfi.isValid(); ++mfi)
{
const Box& vbx = mfi.validbox();
auto const& afab = m_a_coeffs[amrlev][mglev].array(mfi);
auto const& afab = linop.m_a_coeffs[amrlev][mglev].array(mfi);
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
auto const& bfab = m_b_coeffs[amrlev][mglev][idim].const_array(mfi);
auto const& bfab = linop.m_b_coeffs[amrlev][mglev][idim].const_array(mfi);
const Box& blo = amrex::adjCellLo(vbx,idim);
const Box& bhi = amrex::adjCellHi(vbx,idim);
bool outside_domain_lo = !(domain.contains(blo));
bool outside_domain_hi = !(domain.contains(bhi));
if ((!outside_domain_lo) && (!outside_domain_hi)) { continue; }
for (int icomp = 0; icomp < ncomp; ++icomp) {
auto const& rbc = (*(this->m_robin_bcval[amrlev]))[mfi].const_array(icomp*3);
if (this->m_lobc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_lo)
auto const& rbc = (*(linop.m_robin_bcval[amrlev]))[mfi].const_array(icomp*3);
if (linop.m_lobc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_lo)
{
if (idim == 0) {
RT fac = bovera*dxi*dxi;
Expand Down Expand Up @@ -546,7 +546,7 @@ MLABecLaplacianT<MF>::applyRobinBCTermsCoeffs ()
});
}
}
if (this->m_hibc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_hi)
if (linop.m_hibc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_hi)
{
if (idim == 0) {
RT fac = bovera*dxi*dxi;
Expand Down Expand Up @@ -579,6 +579,16 @@ MLABecLaplacianT<MF>::applyRobinBCTermsCoeffs ()
}
}
}
} // namespace detail

template <typename MF>
void
MLABecLaplacianT<MF>::applyRobinBCTermsCoeffs ()
{
if (this->hasRobinBC()) {
detail::applyRobinBCTermsCoeffs(*this);
}
}

template <typename MF>
void
Expand Down
4 changes: 2 additions & 2 deletions Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public:
RT location;
};

Vector<std::unique_ptr<MF> > m_robin_bcval;

protected:

bool m_has_metric_term = false;
Expand Down Expand Up @@ -182,8 +184,6 @@ protected:
};
Vector<Vector<std::unique_ptr<BndryCondLoc> > > m_bcondloc;

Vector<std::unique_ptr<MF> > m_robin_bcval;

// used to save interpolation coefficients of the first interior cells
mutable Vector<Vector<BndryRegisterT<MF>> > m_undrrelxr;

Expand Down
Loading

0 comments on commit de8e3a0

Please sign in to comment.