chombo-discharge
CD_FieldSolverMultigrid.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_FieldSolverMultigrid_H
13 #define CD_FieldSolverMultigrid_H
14 
15 // Chombo includes
16 #include <AMRMultiGrid.H>
17 #include <BiCGStabSolver.H>
18 #include <MFSimpleSolver.H>
19 #include <GMRESSolver.H>
20 
21 // Our includes
22 #include <CD_FieldSolver.H>
24 #include <CD_NamespaceHeader.H>
25 
33 {
34 public:
40 
45  FieldSolverMultigrid(const FieldSolverMultigrid& a_other) = delete;
46 
51  FieldSolverMultigrid(const FieldSolverMultigrid&& a_other) = delete;
52 
58  operator=(const FieldSolverMultigrid& a_other) = delete;
59 
65  operator=(const FieldSolverMultigrid&& a_other) = delete;
66 
70  virtual ~FieldSolverMultigrid();
71 
81  virtual bool
82  solve(MFAMRCellData& a_potential,
83  const MFAMRCellData& a_rho,
84  const EBAMRIVData& a_sigma,
85  const bool a_zeroPhi = false) override;
86 
90  virtual void
91  parseOptions() override;
92 
96  virtual void
97  parseRuntimeOptions() override;
98 
104  virtual void
105  computeElectricField(MFAMRCellData& a_E, const MFAMRCellData& a_potential) const override;
106 
112  virtual void
113  computeElectricField(MFAMRFluxData& a_E, const MFAMRCellData& a_potential) const override;
114 
121  virtual void
123  const phase::which_phase a_phase,
124  const MFAMRCellData& a_potential) const override;
125 
132  virtual void
134  const phase::which_phase a_phase,
135  const MFAMRCellData& a_potential) const override;
136 
142  virtual void
143  preRegrid(const int a_lbase, const int a_oldFinestLevel) override;
144 
153  virtual void
154  regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override;
155 
159  virtual void
160  registerOperators() override;
161 
165  virtual void
166  setupSolver() override;
167 
174  virtual void
175  setSolverPermittivities(const MFAMRCellData& a_permittivityCell,
176  const MFAMRFluxData& a_permittivityFace,
177  const MFAMRIVData& a_permittivityEB) override;
178 
185  virtual Vector<long long>
186  computeLoads(const DisjointBoxLayout& a_dbl, const int a_level) override;
187 
188 protected:
192  static constexpr Real m_alpha = 0.0;
193 
197  static constexpr Real m_beta = -1.0;
198 
202  enum class BottomSolverType
203  {
204  Simple,
205  BiCGStab,
206  GMRES
207  };
208 
212  enum class MultigridType
213  {
214  VCycle,
215  WCycle,
216  };
217 
221  enum class JumpBCType
222  {
223  Natural,
224  SaturationCharge,
225  };
226 
231 
236 
241 
246 
251 
256 
261 
266 
271 
276 
281 
286 
291 
296 
301 
306 
311 
316 
321 
326 
332 
338 
342  RefCountedPtr<MFHelmholtzOpFactory> m_helmholtzOpFactory;
343 
347  RefCountedPtr<AMRMultiGrid<LevelData<MFCellFAB>>> m_multigridSolver;
348 
352  BiCGStabSolver<LevelData<MFCellFAB>> m_bicgstab;
353 
357  GMRESSolver<LevelData<MFCellFAB>> m_gmres;
358 
362  MFSimpleSolver m_mfsolver;
363 
367  virtual void
369 
373  virtual void
375 
379  virtual void
380  parseJumpBC();
381 
387  virtual void
388  setPermittivities() override;
389 
393  virtual void
395 
399  virtual void
400  setupMultigrid();
401 };
402 
403 #include <CD_NamespaceFooter.H>
404 
405 #endif
Contains declaration of a base electrostatics solver class.
Declaration of a factory class for making multifluid Helmholtz operators for multigrid.
Implementation of FieldSolver which uses multigrid.
Definition: CD_FieldSolverMultigrid.H:33
virtual void parseMultigridSettings()
Parse multigrid settings.
Definition: CD_FieldSolverMultigrid.cpp:91
RefCountedPtr< AMRMultiGrid< LevelData< MFCellFAB > > > m_multigridSolver
Geometric multigrid solver.
Definition: CD_FieldSolverMultigrid.H:347
virtual void setupHelmholtzFactory()
Set up the multigrid operator factory.
Definition: CD_FieldSolverMultigrid.cpp:530
virtual void parseJumpBC()
Parse JumpBC type.
Definition: CD_FieldSolverMultigrid.cpp:192
MFSimpleSolver m_mfsolver
multi-fluid simple solver
Definition: CD_FieldSolverMultigrid.H:362
int m_multigridMinIterations
Minimum number of iterations.
Definition: CD_FieldSolverMultigrid.H:290
int m_multigridMaxIterations
Maximum number of iterations.
Definition: CD_FieldSolverMultigrid.H:285
RefCountedPtr< MFHelmholtzOpFactory > m_helmholtzOpFactory
Multigrid operator factory.
Definition: CD_FieldSolverMultigrid.H:342
int m_numSmoothingsForSimpleSolver
Number of smoothing for bottom solver.
Definition: CD_FieldSolverMultigrid.H:295
FieldSolverMultigrid(const FieldSolverMultigrid &a_other)=delete
Disallowed copy constructor.
int m_multigridBottomSmooth
Number of smoothing before bottom solver.
Definition: CD_FieldSolverMultigrid.H:280
virtual void setupSolver() override
Set up multigrid solver.
Definition: CD_FieldSolverMultigrid.cpp:400
virtual ~FieldSolverMultigrid()
Constructor (does nothing)
Definition: CD_FieldSolverMultigrid.cpp:40
int m_multigridJumpOrder
Set bc jump order.
Definition: CD_FieldSolverMultigrid.H:320
virtual void preRegrid(const int a_lbase, const int a_oldFinestLevel) override
Cache state before regridding.
Definition: CD_FieldSolverMultigrid.cpp:347
FieldSolverMultigrid & operator=(const FieldSolverMultigrid &a_other)=delete
Disallowed copy assignment operator.
MFHelmholtzOp::Smoother m_multigridRelaxMethod
Relaxation type for gmg.
Definition: CD_FieldSolverMultigrid.H:230
FieldSolverMultigrid(const FieldSolverMultigrid &&a_other)=delete
Disallowed move constructor.
virtual void setSolverPermittivities(const MFAMRCellData &a_permittivityCell, const MFAMRFluxData &a_permittivityFace, const MFAMRIVData &a_permittivityEB) override
Set new permittivities for the multigrid solver.
Definition: CD_FieldSolverMultigrid.cpp:414
bool m_isSolverSetup
Needs setup.
Definition: CD_FieldSolverMultigrid.H:255
int m_multigridBcWeight
Set bc weight (used for weighted least squares)
Definition: CD_FieldSolverMultigrid.H:315
Real m_multigridExitTolerance
Exit tolerance for multigrid.
Definition: CD_FieldSolverMultigrid.H:331
virtual void setPermittivities() override
Set the permittivities.
Definition: CD_FieldSolverMultigrid.cpp:461
virtual Vector< long long > computeLoads(const DisjointBoxLayout &a_dbl, const int a_level) override
Compute grid loads.
Definition: CD_FieldSolverMultigrid.cpp:764
virtual void registerOperators() override
Registers required operators for AMR for this class.
Definition: CD_FieldSolverMultigrid.cpp:374
int m_multigridSmooth
Number of smoothing for multigrid.
Definition: CD_FieldSolverMultigrid.H:265
virtual void parseRuntimeOptions() override
Parse runtime options from command line or input script.
Definition: CD_FieldSolverMultigrid.cpp:63
BottomSolverType
Enum class for supported bottom solvers in multigrid.
Definition: CD_FieldSolverMultigrid.H:203
JumpBCType m_jumpBcType
JumpBC type.
Definition: CD_FieldSolverMultigrid.H:245
MultigridType m_multigridType
GMG multigrid type.
Definition: CD_FieldSolverMultigrid.H:235
FieldSolverMultigrid()
Weak constructor.
Definition: CD_FieldSolverMultigrid.cpp:31
JumpBCType
Jump BC type.
Definition: CD_FieldSolverMultigrid.H:222
static constexpr Real m_alpha
alpha-coefficient (for Helmholtz operator)
Definition: CD_FieldSolverMultigrid.H:192
MultigridType
Enum for multigrid cycle types.
Definition: CD_FieldSolverMultigrid.H:213
int m_multigridPreSmooth
Number of smoothings before averaging.
Definition: CD_FieldSolverMultigrid.H:270
BiCGStabSolver< LevelData< MFCellFAB > > m_bicgstab
Conjugate gradient solver bottom MG level.
Definition: CD_FieldSolverMultigrid.H:352
int m_multigridJumpWeight
Set bc jump weight (used for weighted least squares)
Definition: CD_FieldSolverMultigrid.H:325
int m_multigridBcOrder
Set bc order.
Definition: CD_FieldSolverMultigrid.H:310
virtual void regrid(const int a_lmin, const int a_oldFinestLevel, const int a_newFinestLevel) override
Regrid method.
Definition: CD_FieldSolverMultigrid.cpp:361
virtual void parseOptions() override
Parse all class options from command-line or input script.
Definition: CD_FieldSolverMultigrid.cpp:46
int m_minCellsBottom
Set bottom drop depth.
Definition: CD_FieldSolverMultigrid.H:300
virtual bool solve(MFAMRCellData &a_potential, const MFAMRCellData &a_rho, const EBAMRIVData &a_sigma, const bool a_zeroPhi=false) override
Solves Poisson equation onto a_phi using a_rho and a_sigma as right-hand sides.
Definition: CD_FieldSolverMultigrid.cpp:218
int m_domainDropOrder
Domain drop order.
Definition: CD_FieldSolverMultigrid.H:305
static constexpr Real m_beta
Beta-coefficient (for Helmholtz operator)
Definition: CD_FieldSolverMultigrid.H:197
bool m_kappaSource
Scale by kappa or not.
Definition: CD_FieldSolverMultigrid.H:250
virtual void parseKappaSource()
Parse m_kappaSource.
Definition: CD_FieldSolverMultigrid.cpp:78
virtual void setupMultigrid()
Set up AMRMultiGrid.
Definition: CD_FieldSolverMultigrid.cpp:664
GMRESSolver< LevelData< MFCellFAB > > m_gmres
GMRES solver.
Definition: CD_FieldSolverMultigrid.H:357
FieldSolverMultigrid & operator=(const FieldSolverMultigrid &&a_other)=delete
Disallowed move assignment operator.
BottomSolverType m_bottomSolverType
Bottom solver type.
Definition: CD_FieldSolverMultigrid.H:240
int m_multigridPostSmooth
Number of smoothings before averaging.
Definition: CD_FieldSolverMultigrid.H:275
int m_multigridVerbosity
Verbosity for geometric multigrid.
Definition: CD_FieldSolverMultigrid.H:260
Real m_multigridExitHang
Exit hang for multigrid.
Definition: CD_FieldSolverMultigrid.H:337
Base class for electrostatic solvers.
Definition: CD_FieldSolver.H:32
virtual void computeElectricField()
Compute the cell-centered electric field.
Definition: CD_FieldSolver.cpp:128
Smoother
Relaxation methods for this operator.
Definition: CD_MFHelmholtzOp.H:49