@@ -10,8 +10,10 @@ namespace amrex {
1010/* *
1111 * \brief curl (alpha curl E) + beta E = rhs
1212 *
13- * Here E is an Array of 3 MultiFabs on staggered grid, alpha is a positive
14- * scalar, and beta is either a non-negative scalar or a MultiFab.
13+ * Here E is an Array of 3 MultiFabs on the staggered grid. The coefficient
14+ * \f$\alpha\f$ can be supplied either as a positive scalar (via setScalars)
15+ * or as a nodal MultiFab (via setAlpha), and \f$\beta\f$ can be either a
16+ * non-negative scalar or an edge-centered MultiFab (via setBeta).
1517 *
1618 * It's the caller's responsibility to make sure rhs has consistent nodal
1719 * data. If needed, one could call prepareRHS for this.
@@ -45,11 +47,21 @@ public:
4547 const LPInfo& a_info = LPInfo(),
4648 int a_coord = 0);
4749
50+ // ! Set scalar coefficients. This clears any previously supplied nodal alpha
51+ // ! or edge-centered beta MultiFabs, so call setAlpha/setBeta afterwards if
52+ // ! you still need spatially varying coefficients.
4853 void setScalars (RT a_alpha, RT a_beta) noexcept ;
4954
50- // ! This is needed only if there is variable beta coefficient.
55+ // ! This is needed only if there is variable beta coefficient. Call this
56+ // ! after setScalars if both APIs are used, because setScalars clears the
57+ // ! cached beta MultiFabs.
5158 void setBeta (const Vector<Array<MultiFab const *,3 >>& a_bcoefs);
5259
60+ // ! Set variable alpha defined on nodal MultiFab. Call this after
61+ // ! setScalars if both APIs are used, because setScalars clears the cached
62+ // ! nodal alpha fields.
63+ void setAlpha (const Vector<MultiFab const *>& a_acoeffs);
64+
5365 // ! Synchronize RHS on nodal points. If the user can guarantee it, this
5466 // ! function does not need to be called.
5567 void prepareRHS (Vector<MF*> const & rhs) const ;
@@ -140,6 +152,8 @@ private:
140152 void update_lusolver ();
141153
142154 void set_curvilinear_domain_bc ();
155+ void clearAlphaMultiFab ();
156+ void clearBetaMultiFab ();
143157
144158 int m_coord = 0 ;
145159
@@ -160,6 +174,7 @@ private:
160174 Vector<Vector<std::unique_ptr<Gpu::DeviceScalar
161175 <LUSolver<AMREX_SPACEDIM*2 ,RT>>>>> m_lusolver;
162176 Vector<Vector<Array<std::unique_ptr<MultiFab>,3 >>> m_bcoefs;
177+ Vector<Vector<Array<std::unique_ptr<MultiFab>,3 >>> m_acoefs;
163178 bool m_use_pcg = false ;
164179 bool m_needs_update = true ;
165180};
0 commit comments