Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Dec 21, 2023
1 parent 8692eab commit 5693bf9
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.H
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ public:
[[nodiscard]] MF makeCoarseAmr (int famrlev, IntVect const& ng) const override;

private:

void applyBC (int amrlev, int mglev, MF& in, BCMode bc_mode, StateMode s_mode) const;

RT m_alpha = std::numeric_limits<RT>::lowest();
RT m_beta = std::numeric_limits<RT>::lowest();
Array<IntVect,AMREX_SPACEDIM> m_etype{IntVect(0,1,1),
IntVect(1,0,1),
IntVect(1,1,0)};
static constexpr int m_ncomp = 1;
using mf_type = typename MF::value_type;
};

Expand Down Expand Up @@ -208,10 +212,11 @@ MLCurlCurlT<MF>::averageDownSolutionRHS (int camrlev, MF& crse_sol, MF& crse_rhs
template <typename MF>
void
MLCurlCurlT<MF>::apply (int amrlev, int mglev, MF& out, MF& in, BCMode bc_mode,
StateMode s_mode, const MLMGBndryT<MF>* bndry) const
StateMode s_mode, const MLMGBndryT<MF>* /*bndry*/) const
{
amrex::ignore_unused(amrlev, mglev, out, in, bc_mode, s_mode, bndry);
amrex::Abort("MLCurlCurlT::apply: TODO");
applyBC(amrlev, mglev, in, bc_mode, s_mode);

amrex::Warning("MLCurlCurlT::apply: TODO");
}

template <typename MF>
Expand All @@ -226,10 +231,14 @@ MLCurlCurlT<MF>::smooth (int amrlev, int mglev, MF& sol, const MF& rhs,
template <typename MF>
void
MLCurlCurlT<MF>::solutionResidual (int amrlev, MF& resid, MF& x, const MF& b,
const MF* crse_bcdata)
const MF* /*crse_bcdata*/)
{
amrex::ignore_unused(amrlev, resid, x, b, crse_bcdata);
amrex::Abort("MLCurlCurlT::solutionResidual: TODO");
BL_PROFILE("MLCurlCurl::solutionResidual()");
const int mglev = 0;
apply(amrlev, mglev, resid, x, BCMode::Inhomogeneous, StateMode::Solution);
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
amrex::Xpay(resid, RT(-1.0), b, 0, 0, m_ncomp, IntVect(0));
}
}

template <typename MF>
Expand Down Expand Up @@ -288,11 +297,9 @@ MLCurlCurlT<MF>::xdoty (int amrlev, int mglev, const MF& x, const MF& y, bool lo

template <typename MF>
typename MLCurlCurlT<MF>::RT
MLCurlCurlT<MF>::normInf (int amrlev, MF const& mf, bool local) const
MLCurlCurlT<MF>::normInf (int /*amrlev*/, MF const& mf, bool local) const
{
amrex::ignore_unused(amrlev, mf, local);
amrex::Abort("MLCurlCurlT::normInf: TODO");
return 0;
return amrex::norminf(mf, 0, m_ncomp, IntVect(0), local);
}

template <typename MF>
Expand Down Expand Up @@ -333,7 +340,7 @@ MLCurlCurlT<MF>::make (int amrlev, int mglev, IntVect const& ng) const
MF r;
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
r[idim].define(amrex::convert(this->m_grids[amrlev][mglev], m_etype[idim]),
this->m_dmap[amrlev][mglev], this->getNComp(), ng, MFInfo(),
this->m_dmap[amrlev][mglev], m_ncomp, ng, MFInfo(),
*(this->m_factory)[amrlev][mglev]);
}
return r;
Expand Down Expand Up @@ -361,7 +368,7 @@ MLCurlCurlT<MF>::makeCoarseMG (int amrlev, int mglev, IntVect const& ng) const
MF r;
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
r[idim].define(amrex::convert(cba, m_etype[idim]),
this->m_dmap[amrlev][mglev], this->getNComp(), ng);
this->m_dmap[amrlev][mglev], m_ncomp, ng);
}
return r;
}
Expand All @@ -377,11 +384,20 @@ MLCurlCurlT<MF>::makeCoarseAmr (int famrlev, IntVect const& ng) const
MF r;
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
r[idim].define(amrex::convert(cba, m_etype[idim]),
this->m_dmap[famrlev][0], this->getNComp(), ng);
this->m_dmap[famrlev][0], m_ncomp, ng);
}
return r;
}

template <typename MF>
void
MLCurlCurlT<MF>::applyBC (int amrlev, int mglev, MF& in, BCMode /*bc_mode*/,
StateMode /*s_mode*/) const
{
Vector<mf_type*> mfs{AMREX_D_DECL(&(in[0]),&(in[1]),&(in[2]))};
FillBoundary(mfs, this->m_geom[amrlev][mglev].periodicity());
}

template <>
struct LinOpData <Array<MultiFab,AMREX_SPACEDIM>, void>
{
Expand Down

0 comments on commit 5693bf9

Please sign in to comment.