15#ifndef CD_FIELDSOLVERAMG_H
16#define CD_FIELDSOLVERAMG_H
29#include <CD_NamespaceHeader.H>
95 solve(MFAMRCellData& a_potential,
96 const MFAMRCellData& a_rho,
97 const EBAMRIVData& a_sigma,
98 const bool a_zeroPhi =
false)
override;
137 const MFAMRCellData& a_potential)
const override;
148 const MFAMRCellData& a_potential)
const override;
157 regrid(
const int a_lmin,
const int a_oldFinestLevel,
const int a_newFinestLevel)
override;
182 const MFAMRFluxData& a_permittivityFace,
183 const MFAMRIVData& a_permittivityEB)
override;
358 static PetscErrorCode
359 monitorResidual(KSP a_ksp, PetscInt a_iteration, PetscReal a_residualNorm,
void* a_context);
368#include <CD_NamespaceFooter.H>
Contains declaration of a base electrostatics solver class.
Declaration of a base class for electrode (EB) boundary conditions of PetscHelmholtzOp.
Declaration of a base class for the interface (jump) conditions of PetscHelmholtzOp.
Declaration of a Helmholtz operator assembled as a PETSc matrix.
Real m_kspAtol
Absolute residual tolerance.
Definition CD_FieldSolverAMG.H:255
JumpBCType
Conditions on the interface between the gas and the dielectrics.
Definition CD_FieldSolverAMG.H:266
virtual void parseStencilSettings()
Parse the order and the least-squares weight of the EB face stencils (eb_order, eb_weight).
Definition CD_FieldSolverAMG.cpp:143
virtual void parseOptions() override
Parse class options.
Definition CD_FieldSolverAMG.cpp:62
int m_kspMaxIter
Maximum number of Krylov iterations.
Definition CD_FieldSolverAMG.H:260
virtual void parseRuntimeOptions() override
Parse class options that can change at run time.
Definition CD_FieldSolverAMG.cpp:78
FieldSolverAMG & operator=(const FieldSolverAMG &a_other)=delete
Disallowed copy assignment operator.
Real m_monitorZeroResidNorm
The 2-norm of the zero-residual b - A*0 = b of the current solve, which the true residual is printed ...
Definition CD_FieldSolverAMG.H:322
FieldSolverAMG(const FieldSolverAMG &&a_other)=delete
Disallowed move constructor.
Real m_monitorFirstNorm
Residual norm of the KSP at its first iteration of the current solve.
Definition CD_FieldSolverAMG.H:327
Real m_kspRtol
Relative residual tolerance.
Definition CD_FieldSolverAMG.H:250
std::string m_amgSmootherKsp
KSP type of the smoother on each level of a multigrid preconditioner, e.g. 'chebyshev' or 'richardson...
Definition CD_FieldSolverAMG.H:220
virtual void registerOperators() override
Register the AMR operators this class needs.
Definition CD_FieldSolverAMG.cpp:635
int m_gamgAggressiveCoarsening
Number of levels that GAMG coarsens aggressively (square graph).
Definition CD_FieldSolverAMG.H:240
JumpBCType m_jumpBcType
Interface condition.
Definition CD_FieldSolverAMG.H:274
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Regrid. The operator is rebuilt on the next solve.
Definition CD_FieldSolverAMG.cpp:611
bool m_kappaSource
Weight the space charge density by the volume fraction in solve, or not, as in FieldSolverGMG.
Definition CD_FieldSolverAMG.H:289
virtual ~FieldSolverAMG()
Destructor. Destroys the PETSc solver, unless PETSc has already been finalized.
Definition CD_FieldSolverAMG.cpp:50
FieldSolverAMG()
Default constructor.
Definition CD_FieldSolverAMG.cpp:37
int m_kspGmresRestart
Restart length of GMRES and FGMRES.
Definition CD_FieldSolverAMG.H:215
RefCountedPtr< PetscHelmholtzOp > m_petscOp
The operator.
Definition CD_FieldSolverAMG.H:304
virtual void invalidateSolver() override
Destroy the PETSc solver and the operator. They are set up again before the next solve.
Definition CD_FieldSolverAMG.cpp:624
int m_amgSmootherIts
Number of smoothing steps on each level of a multigrid preconditioner.
Definition CD_FieldSolverAMG.H:230
std::string m_pcType
PETSc preconditioner type, e.g. 'gamg' or 'hypre'.
Definition CD_FieldSolverAMG.H:245
virtual void setupSolver() override
Assemble the operator and set up the PETSc solver.
Definition CD_FieldSolverAMG.cpp:307
std::string m_kspType
PETSc Krylov solver type, e.g. 'gmres', 'fgmres', 'bcgs' (also given as 'bicgstab') or 'cg'.
Definition CD_FieldSolverAMG.H:210
int m_petscVerbosity
Verbosity of the PETSc solve.
Definition CD_FieldSolverAMG.H:316
static constexpr Real m_alpha
Operator alpha. There is no diagonal term.
Definition CD_FieldSolverAMG.H:195
Real m_gamgThreshold
GAMG graph threshold: connections weaker than this are dropped when aggregating. Negative keeps them ...
Definition CD_FieldSolverAMG.H:235
virtual void setSolverPermittivities(const MFAMRCellData &a_permittivityCell, const MFAMRFluxData &a_permittivityFace, const MFAMRIVData &a_permittivityEB) override
Change the permittivities used by the solver, e.g. for a semi-implicit scheme.
Definition CD_FieldSolverAMG.cpp:588
RefCountedPtr< PetscHelmholtzJumpBC > m_petscJumpBc
Conditions on the interface between the gas and the dielectrics.
Definition CD_FieldSolverAMG.H:299
static PetscErrorCode monitorResidual(KSP a_ksp, PetscInt a_iteration, PetscReal a_residualNorm, void *a_context)
KSP monitor that prints the residual at every iteration, as the Krylov solvers of FieldSolverGMG do.
Definition CD_FieldSolverAMG.cpp:524
KSP m_ksp
The PETSc solver.
Definition CD_FieldSolverAMG.H:309
Real m_monitorPreviousNorm
Residual norm of the KSP at the previous iteration of the current solve.
Definition CD_FieldSolverAMG.H:332
RefCountedPtr< PetscHelmholtzEBBC > m_petscEbBc
Boundary conditions on the electrode faces.
Definition CD_FieldSolverAMG.H:294
std::string m_amgSmootherPc
PC type of the smoother on each level of a multigrid preconditioner, e.g. 'sor' or 'jacobi'.
Definition CD_FieldSolverAMG.H:225
int m_ebWeight
Least-squares weighting of the EB face stencils.
Definition CD_FieldSolverAMG.H:284
virtual bool solve(MFAMRCellData &a_potential, const MFAMRCellData &a_rho, const EBAMRIVData &a_sigma, const bool a_zeroPhi=false) override
Solve the Poisson equation.
Definition CD_FieldSolverAMG.cpp:158
friend class FieldSolverMG
FieldSolverMG owns a FieldSolverAMG as its algebraic multigrid stage, and parses its settings and sha...
Definition CD_FieldSolverAMG.H:45
static constexpr Real m_beta
Operator beta. The operator is -div(eps * grad(phi)).
Definition CD_FieldSolverAMG.H:200
bool m_isSolverSetup
Is the solver set up or not.
Definition CD_FieldSolverAMG.H:205
int m_ebOrder
Highest order of the EB face stencils, for the electrode and the interface faces.
Definition CD_FieldSolverAMG.H:279
FieldSolverAMG & operator=(const FieldSolverAMG &&a_other)=delete
Disallowed move assignment operator.
virtual void parseSolverSettings()
Parse the PETSc solver settings.
Definition CD_FieldSolverAMG.cpp:91
virtual void destroySolver()
Destroy the PETSc solver and the operator.
Definition CD_FieldSolverAMG.cpp:566
FieldSolverAMG(const FieldSolverAMG &a_other)=delete
Disallowed copy constructor.
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