Skip to content

Commit 2e8bb8e

Browse files
limit pc width to 0 in 3D for now.
1 parent 439989b commit 2e8bb8e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Source/FieldSolver/ImplicitSolvers/ImplicitSolver.H

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ public:
110110
return nullptr;
111111
}
112112

113+
/**
114+
* \brief Return the IntVect number of components for the mass matrices used in
115+
* the preconditioner for field direction field_dir
116+
*/
117+
amrex::IntVect GetMassMatricesPCNcomp (const int field_dir) const
118+
{
119+
if (field_dir == 0) { return m_ncomp_pc_xx; }
120+
else if (field_dir == 1) { return m_ncomp_pc_yy; }
121+
else if (field_dir == 2) { return m_ncomp_pc_zz; }
122+
else { return amrex::IntVect{-1}; }
123+
}
124+
113125
// This parameter is used for the time-step fraction in the PC for implicit
114126
// treatment of light waves in the curl-curl MLMG solver.
115127
// This function should return zero if light waves are not treated implicitly

Source/FieldSolver/ImplicitSolvers/ImplicitSolver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,9 @@ void ImplicitSolver::parseNonlinearSolverParams ( const amrex::ParmParse& pp )
482482
}
483483
if (m_use_mass_matrices_pc) {
484484
m_mass_matrices_pc_width = 0;
485+
#if AMREX_SPACEDIM != 3
485486
pp.query("mass_matrices_pc_width", m_mass_matrices_pc_width);
487+
#endif
486488
}
487489
#if defined(WARPX_DIM_RCYLINDER)
488490
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -843,7 +845,8 @@ void ImplicitSolver::SyncMassMatricesPCAndApplyBCs ()
843845
amrex::MultiFab* MM_yy = m_WarpX->m_fields.get(FieldType::MassMatrices_Y, Direction{1}, lev);
844846
amrex::MultiFab* MM_zz = m_WarpX->m_fields.get(FieldType::MassMatrices_Z, Direction{2}, lev);
845847
ablastr::fields::VectorField MM_PC = m_WarpX->m_fields.get_alldirs(FieldType::MassMatrices_PC, lev);
846-
#if AMREX_SPACEDIM == 1
848+
#if (AMREX_SPACEDIM == 1) || (AMREX_SPACEDIM == 3)
849+
// Only works for SPACEDIM = 3 because we limit width = 0 for now in 3D
847850
const int init_comp_xx = diag_comp_xx - MM_PC_xx_width[0];
848851
const int init_comp_yy = diag_comp_yy - MM_PC_yy_width[0];
849852
const int init_comp_zz = diag_comp_zz - MM_PC_zz_width[0];

0 commit comments

Comments
 (0)