13#ifndef CD_FIELDSOLVERMG_H
14#define CD_FIELDSOLVERMG_H
25#include <CD_NamespaceHeader.H>
97 solve(MFAMRCellData& a_phi,
const MFAMRCellData& a_rho,
const EBAMRIVData& a_sigma,
const bool a_zeroPhi)
override;
151 const MFAMRFluxData& a_permittivityFace,
152 const MFAMRIVData& a_permittivityEB)
override;
160 preRegrid(
const int a_lbase,
const int a_oldFinestLevel)
override;
169 regrid(
const int a_lmin,
const int a_oldFinestLevel,
const int a_newFinestLevel)
override;
196 const MFAMRCellData& a_potential)
const override;
207 const MFAMRCellData& a_potential)
const override;
215 virtual Vector<long long>
216 computeLoads(
const DisjointBoxLayout& a_dbl,
const int a_level)
override;
222 RefCountedPtr<FieldSolverGMG>
m_gmg;
263 RefCountedPtr<FieldSolverAMG>
m_amg;
322 solveAMG(MFAMRCellData& a_phi,
const MFAMRCellData& a_rho,
const EBAMRIVData& a_sigma);
326#include <CD_NamespaceFooter.H>
Declaration of the FieldSolverAMG class.
Declaration of FieldSolverGMG.
Contains declaration of a base electrostatics solver class.
virtual Vector< long long > computeLoads(const DisjointBoxLayout &a_dbl, const int a_level) override
Compute grid loads, from the geometric multigrid relaxation.
Definition CD_FieldSolverMG.cpp:548
virtual void parseRuntimeOptions() override
Parse class options that can change at run time.
Definition CD_FieldSolverMG.cpp:70
virtual void invalidateSolver() override
Discard the discretizations and the solver hierarchies of both solvers.
Definition CD_FieldSolverMG.cpp:266
FieldSolverMG & operator=(const FieldSolverMG &&a_other)=delete
Disallowed move assignment operator.
int m_solvesSinceProbe
Number of solves since geometric multigrid was last tried.
Definition CD_FieldSolverMG.H:288
virtual void syncSolvers()
Share this solver's data and configuration with the solvers that exist.
Definition CD_FieldSolverMG.cpp:162
virtual void registerOperators() override
Register the AMR operators that the geometric and algebraic multigrid solvers need.
Definition CD_FieldSolverMG.cpp:179
virtual void parseOptions() override
Parse class options, including those of the geometric and algebraic multigrid solvers.
Definition CD_FieldSolverMG.cpp:51
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Regrid. The solvers are set up again on the next solve.
Definition CD_FieldSolverMG.cpp:328
int m_bcOrder
Order of the EB stencils on electrodes and dielectric interfaces, in both solvers.
Definition CD_FieldSolverMG.H:232
RefCountedPtr< FieldSolverAMG > m_amg
The algebraic multigrid solver. Null unless amg_fallback is true.
Definition CD_FieldSolverMG.H:263
virtual void allocate() override
Allocate the data, and share it with the solvers.
Definition CD_FieldSolverMG.cpp:195
virtual ~FieldSolverMG()
Destructor.
Definition CD_FieldSolverMG.cpp:45
MFAMRCellData m_solverPermCell
Cell-centered permittivity from the last setSolverPermittivities. Shares the caller's storage.
Definition CD_FieldSolverMG.H:247
RefCountedPtr< FieldSolverGMG > m_gmg
The geometric multigrid solver.
Definition CD_FieldSolverMG.H:222
virtual bool solveAMG(MFAMRCellData &a_phi, const MFAMRCellData &a_rho, const EBAMRIVData &a_sigma)
Solve with algebraic multigrid, setting it up first if needed.
Definition CD_FieldSolverMG.cpp:464
bool m_amgFallback
Fall back to algebraic multigrid or not.
Definition CD_FieldSolverMG.H:273
virtual void deallocate() override
Release the data, also in the solvers.
Definition CD_FieldSolverMG.cpp:214
MFAMRCellData m_phiStart
Initial guess of the current solve. Algebraic multigrid starts from it when geometric multigrid fails...
Definition CD_FieldSolverMG.H:268
bool m_amgLatched
True after algebraic multigrid rescued a solve, until geometric multigrid converges again.
Definition CD_FieldSolverMG.H:278
virtual void setupSolver() override
Set up geometric multigrid. Algebraic multigrid is set up when it is first needed.
Definition CD_FieldSolverMG.cpp:238
MFAMRFluxData m_solverPermFace
Face-centered permittivity from the last setSolverPermittivities. Shares the caller's storage.
Definition CD_FieldSolverMG.H:252
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel) override
Cache the potential before a regrid, and discard both solvers.
Definition CD_FieldSolverMG.cpp:315
bool m_hasSolverPermittivities
True if setSolverPermittivities was called after the last setup.
Definition CD_FieldSolverMG.H:242
FieldSolverMG()
Constructor. Creates the geometric multigrid solver.
Definition CD_FieldSolverMG.cpp:25
virtual void parseSolverSettings()
Parse the settings of both solvers, the EB stencils and the fallback.
Definition CD_FieldSolverMG.cpp:84
FieldSolverMG(const FieldSolverMG &&a_other)=delete
Disallowed move constructor.
MFAMRIVData m_solverPermEB
EB-centered permittivity from the last setSolverPermittivities. Shares the caller's storage.
Definition CD_FieldSolverMG.H:257
int m_amgRetryInterval
While latched, geometric multigrid is re-tried every this many solves.
Definition CD_FieldSolverMG.H:283
int m_bcWeight
Least-squares weight of the EB stencils on electrodes and dielectric interfaces, in both solvers.
Definition CD_FieldSolverMG.H:237
FieldSolverMG & operator=(const FieldSolverMG &a_other)=delete
Disallowed copy assignment operator.
FieldSolverMG(const FieldSolverMG &a_other)=delete
Disallowed copy constructor.
virtual bool isAMGSupported(std::string &a_reason) const
Check if algebraic multigrid supports the current domain and grids.
Definition CD_FieldSolverMG.cpp:431
virtual void setSolverPermittivities(const MFAMRCellData &a_permittivityCell, const MFAMRFluxData &a_permittivityFace, const MFAMRIVData &a_permittivityEB) override
Change the permittivities used by the solvers, e.g. for a semi-implicit scheme.
Definition CD_FieldSolverMG.cpp:285
virtual bool solve(MFAMRCellData &a_phi, const MFAMRCellData &a_rho, const EBAMRIVData &a_sigma, const bool a_zeroPhi) override
Solve the Poisson equation, with geometric multigrid first and algebraic multigrid as fallback.
Definition CD_FieldSolverMG.cpp:341
bool m_isSolverSetup
Is the solver set up or not.
Definition CD_FieldSolverMG.H:227
FieldSolver()
Constructor.
Definition CD_FieldSolver.cpp:34
virtual void computeElectricField()
Compute the cell-centered electric field.
Definition CD_FieldSolver.cpp:131
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38