Field solver that solves with geometric multigrid, and falls back to algebraic multigrid when that fails.
More...
|
|
| FieldSolverMG () |
| | Constructor. Creates the geometric multigrid solver.
|
| | FieldSolverMG (const FieldSolverMG &a_other)=delete |
| | Disallowed copy constructor.
|
| | FieldSolverMG (const FieldSolverMG &&a_other)=delete |
| | Disallowed move constructor.
|
| FieldSolverMG & | operator= (const FieldSolverMG &a_other)=delete |
| | Disallowed copy assignment operator.
|
| FieldSolverMG & | operator= (const FieldSolverMG &&a_other)=delete |
| | Disallowed move assignment operator.
|
|
virtual | ~FieldSolverMG () |
| | Destructor.
|
| 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.
|
| virtual void | parseOptions () override |
| | Parse class options, including those of the geometric and algebraic multigrid solvers.
|
| virtual void | parseRuntimeOptions () override |
| | Parse class options that can change at run time.
|
| virtual void | registerOperators () override |
| | Register the AMR operators that the geometric and algebraic multigrid solvers need.
|
| virtual void | allocate () override |
| | Allocate the data, and share it with the solvers.
|
| virtual void | deallocate () override |
| | Release the data, also in the solvers.
|
| virtual void | setupSolver () override |
| | Set up geometric multigrid. Algebraic multigrid is set up when it is first needed.
|
| virtual void | invalidateSolver () override |
| | Discard the discretizations and the solver hierarchies of both solvers.
|
| 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.
|
| virtual void | preRegrid (const int a_lbase, const int a_oldFinestLevel) override |
| | Cache the potential before a regrid, and discard both solvers.
|
| 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.
|
| virtual void | computeElectricField (MFAMRCellData &a_E, const MFAMRCellData &a_potential) const override |
| | Compute the cell-centered electric field.
|
| virtual void | computeElectricField (MFAMRFluxData &a_E, const MFAMRCellData &a_potential) const override |
| | Compute the face-centered electric field.
|
| virtual void | computeElectricField (EBAMRCellData &a_E, const phase::which_phase a_phase, const MFAMRCellData &a_potential) const override |
| | Compute the cell-centered electric field on a phase.
|
| virtual void | computeElectricField (EBAMRFluxData &a_E, const phase::which_phase a_phase, const MFAMRCellData &a_potential) const override |
| | Compute the face-centered electric field on a phase.
|
| virtual Vector< long long > | computeLoads (const DisjointBoxLayout &a_dbl, const int a_level) override |
| | Compute grid loads, from the geometric multigrid relaxation.
|
|
| FieldSolver () |
| | Constructor.
|
| | FieldSolver (const FieldSolver &a_other)=delete |
| | Disallowed copy constructor.
|
| | FieldSolver (const FieldSolver &&a_other)=delete |
| | Disallowed move constructor.
|
| FieldSolver & | operator= (const FieldSolver &a_other)=delete |
| | Disallowed copy assignment operator.
|
| FieldSolver & | operator= (const FieldSolver &&a_other)=delete |
| | Disallowed move assignment operator.
|
|
virtual | ~FieldSolver () |
| | Constructor.
|
| virtual bool | solve (const bool a_zeroPhi=false) |
| | Solve Poisson equation using m_potential, m_rho, and m_sigma.
|
| virtual bool | solve (MFAMRCellData &a_potential, const bool a_zerophi=false) |
| | Solve Poisson equation onto a_phi using m_rho, and m_sigma as right-hand sides.
|
| virtual void | computeElectricField () |
| | Compute the cell-centered electric field.
|
| virtual void | computeDisplacementField (MFAMRCellData &a_displacementField, const MFAMRCellData &a_electricField) |
| | Compute displacement field from the electric field.
|
| void | setRho (const Real a_rho) |
| | Set space charge to constant value everywhere.
|
| void | setRho (const std::function< Real(const RealVect)> &a_rho) |
| | Set space charge to spatially dependent function.
|
| void | setSigma (const Real a_sigma) |
| | Set surface charge to specified value.
|
| void | setSigma (const std::function< Real(const RealVect)> &a_sigma) |
| | Set surface charge density to spatially dependent function.
|
| void | setComputationalGeometry (const RefCountedPtr< ComputationalGeometry > &a_computationalGeometry) |
| | Set the computational geometry.
|
| void | setAmr (const RefCountedPtr< AmrMesh > &a_amr) |
| | Set the amr object.
|
| virtual void | setPermittivities () |
| | Set the permittivities.
|
| virtual void | writePlotFile () |
| | Write plot file.
|
| virtual void | postCheckpoint () |
| | Post checkpoint method.
|
| virtual void | writePlotData (LevelData< EBCellFAB > &a_output, int &a_comp, const std::string &a_outputRealm, const int a_level, const bool a_forceNoInterp=false) const noexcept |
| | Write output data to a_output.
|
| virtual void | writeMultifluidData (LevelData< EBCellFAB > &a_output, int &a_comp, const MFAMRCellData &a_data, const phase::which_phase a_phase, const std::string &a_outputRealm, const int a_level, const bool a_interp) const noexcept |
| | Write multifluid data to single-fluid data holders.
|
| virtual void | writeSurfaceData (LevelData< EBCellFAB > &a_output, int &a_comp, const LevelData< BaseIVFAB< Real > > &a_data, const std::string &a_outputRealm, const int a_level) const noexcept |
| | Write surface data to volume data holder.
|
| void | setRealm (const std::string &a_realm) |
| | Set Realm.
|
| void | setTime (const int a_timeStep, const Real a_time, const Real a_dt) |
| | Set time for this solver.
|
| void | setVerbosity (const int a_verbosity) |
| | Set verbosity.
|
| virtual void | setVoltage (std::function< Real(const Real a_time)> a_voltage) |
| | Set potential dependence in time.
|
| virtual void | setDomainSideBcFunction (const int a_dir, const Side::LoHiSide a_side, const ElectrostaticDomainBc::BcFunction &a_function) |
| | Boundary condition function on a domain side.
|
| virtual void | setElectrodeDirichletFunction (const int a_electrode, const ElectrostaticEbBc::BcFunction &a_function) |
| | Set embedded boundary Dirichlet function on a specific electrode.
|
| virtual int | getNumberOfPlotVariables () const |
| | Get number of output fields.
|
| const std::function< Real(const Real a_time)> & | getVoltage () const |
| | Get voltage function.
|
| Real | getCurrentVoltage () const |
| | Get current voltage.
|
| Real | getTime () const |
| | Get time.
|
| Real | computeCapacitance () |
| | Compute the capacitance.
|
| Real | computeEnergy (const MFAMRCellData &a_electricField) |
| | Compute energy density U = 0.5*int(E.dot.D dV).
|
| virtual Vector< std::string > | getPlotVariableNames () const |
| | Get output plot names.
|
| void | setDataLocation (const Location::Cell a_dataLocation) |
| | Set the data location for the solver.
|
| std::string | getRealm () const |
| | Get the Realm where this solver is registered.
|
| MFAMRCellData & | getPotential () |
| | Get potential on both phases.
|
| MFAMRCellData & | getElectricField () |
| | Get electric field on both phases.
|
| MFAMRCellData & | getRho () |
| | Get storage for the space charge density.
|
| MFAMRCellData & | getResidue () |
| | Get the residue.
|
| MFAMRCellData & | getPermittivityCell () |
| | Get cell-centered permittivity.
|
| MFAMRFluxData & | getPermittivityFace () |
| | Get face-centered permittivity.
|
| MFAMRIVData & | getPermittivityEB () |
| | Get irregular b coefficient.
|
| EBAMRIVData & | getSigma () |
| | Get m_sigma.
|
| Location::Cell | getDataLocation () const |
| | Get data location.
|
|
| virtual void | parseSolverSettings () |
| | Parse the settings of both solvers, the EB stencils and the fallback.
|
|
virtual void | syncSolvers () |
| | Share this solver's data and configuration with the solvers that exist.
|
| virtual bool | isAMGSupported (std::string &a_reason) const |
| | Check if algebraic multigrid supports the current domain and grids.
|
| virtual bool | solveAMG (MFAMRCellData &a_phi, const MFAMRCellData &a_rho, const EBAMRIVData &a_sigma) |
| | Solve with algebraic multigrid, setting it up first if needed.
|
|
virtual void | parseVerbosity () |
| | Parse solver class verbosity.
|
| virtual void | parsePlotVariables () |
| | Function which parses which plot variables to write to plot files.
|
|
virtual void | parseDomainBc () |
| | Parse domain boundary conditions.
|
|
virtual void | parseRegridSlopes () |
| | Parse slope regrid.
|
|
virtual void | setDefaultDomainBcFunctions () |
| | Set default BC functions. This sets all the m_domainBcFunction objects to s_defaultDomainBcFunction, which return 1 everywhere.
|
| virtual void | setDefaultEbBcFunctions () |
| | Set default Dirichlet boundary conditions on the embedded boundaries.
|
| Real | getDielectricPermittivity (const RealVect &a_pos) const |
| | Get relative permittivity at some point in space.
|
| virtual void | setCellPermittivities (EBCellFAB &a_relPerm, const Box &a_cellBox, const EBISBox &a_ebisbox, const RealVect &a_probLo, const Real &a_dx, VoFIterator &a_vofit) |
| | Set cell-centered permittivities.
|
| virtual void | setFacePermittivities (EBFluxFAB &a_relPerm, const Box &a_cellBox, const EBISBox &a_ebisbox, const RealVect &a_probLo, const Real &a_dx, std::array< FaceIterator, SpaceDim > &a_faceIter) |
| | Set face-centered permittivities.
|
| virtual void | setEbPermittivities (BaseIVFAB< Real > &a_relPerm, const Box &a_cellBox, const EBISBox &a_ebisbox, const RealVect &a_origin, const Real &a_dx, VoFIterator &a_vofit) |
| | Set EB-centered permittivities.
|
| virtual ElectrostaticDomainBc::BcType | parseBcString (const std::string &a_str) const |
| | Returns BC type based on string.
|
| virtual std::string | makeBcString (const int a_dir, const Side::LoHiSide a_side) const |
| | Shortcut for making a boundary condition string.
|
| virtual void | fillCoveredPotential (MFAMRCellData &a_phi) const noexcept |
| | Utility routine that fills the gas-side covered cells by the potential from the closest electrode.
|
| void | aliasState (const FieldSolver &a_owner) |
| | Share the data and the configuration of another solver.
|
|
|
RefCountedPtr< FieldSolverGMG > | m_gmg |
| | The geometric multigrid solver.
|
|
bool | m_isSolverSetup |
| | Is the solver set up or not.
|
|
int | m_bcOrder |
| | Order of the EB stencils on electrodes and dielectric interfaces, in both solvers.
|
|
int | m_bcWeight |
| | Least-squares weight of the EB stencils on electrodes and dielectric interfaces, in both solvers.
|
|
bool | m_hasSolverPermittivities |
| | True if setSolverPermittivities was called after the last setup.
|
|
MFAMRCellData | m_solverPermCell |
| | Cell-centered permittivity from the last setSolverPermittivities. Shares the caller's storage.
|
|
MFAMRFluxData | m_solverPermFace |
| | Face-centered permittivity from the last setSolverPermittivities. Shares the caller's storage.
|
|
MFAMRIVData | m_solverPermEB |
| | EB-centered permittivity from the last setSolverPermittivities. Shares the caller's storage.
|
|
RefCountedPtr< FieldSolverAMG > | m_amg |
| | The algebraic multigrid solver. Null unless amg_fallback is true.
|
|
MFAMRCellData | m_phiStart |
| | Initial guess of the current solve. Algebraic multigrid starts from it when geometric multigrid fails.
|
|
bool | m_amgFallback |
| | Fall back to algebraic multigrid or not.
|
|
bool | m_amgLatched |
| | True after algebraic multigrid rescued a solve, until geometric multigrid converges again.
|
|
int | m_amgRetryInterval |
| | While latched, geometric multigrid is re-tried every this many solves.
|
|
int | m_solvesSinceProbe |
| | Number of solves since geometric multigrid was last tried.
|
|
Location::Cell | m_dataLocation |
| | Flag which specifies that data location.
|
|
Location::Face | m_faceLocation |
| | Flag which specifies where the permittivities are stored.
|
|
std::string | m_realm |
| | Realm where this solver is registered.
|
|
std::string | m_className |
| | Class name (i.e., "FieldSolver" for the base class).
|
|
RefCountedPtr< MultiFluidIndexSpace > | m_multifluidIndexSpace |
| | Multifluid index space.
|
|
RefCountedPtr< ComputationalGeometry > | m_computationalGeometry |
| | Computational geometry.
|
|
RefCountedPtr< AmrMesh > | m_amr |
| | AMR - needed for pretty much everything.
|
|
MFAMRCellData | m_cache |
| | Cached state used for regridding.
|
| Vector< RefCountedPtr< LayoutData< VoFIterator > > > | m_grownCellVofIter |
| | Pre-built VoFIterators for grown-box irregular cells (solid phase, grow=1).
|
|
MFAMRCellData | m_potential |
| | State data, i.e. the potential. The centering of this is the same as m_dataLocation.
|
|
MFAMRCellData | m_electricField |
| | Electric field. The centering of this is the same as m_dataLocation.
|
|
MFAMRCellData | m_rho |
| | Storage for space charge density.
|
|
EBAMRIVData | m_sigma |
| | Storage for surface charge density.
|
|
MFAMRCellData | m_residue |
| | Residue, e.g. used after solving Poisson equation.
|
|
MFAMRCellData | m_permittivityCell |
| | Cell permittivity.
|
|
MFAMRFluxData | m_permittivityFace |
| | Face permittivity.
|
|
MFAMRIVData | m_permittivityEB |
| | EB permittivity.
|
|
bool | m_isVoltageSet |
| | Flag for checking if voltage has been set.
|
|
bool | m_plotPotential |
| | If true, potential will be added to plot files.
|
|
bool | m_plotRho |
| | If true, space charge will be added to plot files.
|
|
bool | m_plotElectricField |
| | If true, the electric field will be added to plot files.
|
|
bool | m_plotElectricFieldSolid |
| | If true, the electric field on the inside of dielectrics will be added to plot files.
|
|
bool | m_plotResidue |
| | If true, the residue will be added to plot files.
|
|
bool | m_plotPermittivity |
| | If true, the permittivity will be added to plot files.
|
|
bool | m_plotSigma |
| | If true, m_sigma will be added to plot files.
|
|
bool | m_regridSlopes |
| | Use slopes when regridding or ont.
|
|
int | m_verbosity |
| | Verbosity for this class.
|
|
int | m_timeStep |
| | Current time step.
|
|
Real | m_dt |
| | Last time step increment.
|
|
Real | m_time |
| | Current time.
|
|
ElectrostaticDomainBc | m_domainBc |
| | Domain boundary conditions for FieldSolver.
|
|
ElectrostaticEbBc | m_ebBc |
| | Dirichlet boundary conditions on electrodes.
|
|
std::map< ElectrostaticDomainBc::DomainSide, ElectrostaticDomainBc::BcFunction > | m_domainBcFunctions |
| | Domain BC functions. This is used to map space/time to a voltage/field at the domain faces.
|
|
std::vector< std::pair< Electrode, ElectrostaticEbBc::BcFunction > > | m_electrodeBcFunctions |
| | BC functions (Dirichlet) on the electrodes. Used to map space/time to a voltage on the electrodes.
|
|
std::function< Real(const Real a_time)> | m_voltage |
| | Voltage function.
|
Field solver that solves with geometric multigrid, and falls back to algebraic multigrid when that fails.
This class composes a FieldSolverGMG and, in builds with PETSc, a FieldSolverAMG. Each solve goes through the geometric multigrid solver chain first (e.g. 'gmg bicgstab'). If that does not converge, the solve is repeated with PETSc's algebraic multigrid, starting from the same initial guess. The algebraic multigrid solver is only set up the first time it is needed after a regrid. Once it has rescued a solve, the following solves go straight to it, and geometric multigrid is re-tried every amg_retry_interval solves.
The two solvers share this solver's data: they read and write its potential, space and surface charge, electric field, residue and permittivities. They also read their settings from this class's input options, so that the boundary conditions, the plot variables, the interface condition and the EB stencils are given once, and agree. The EB stencil order and weight (bc_order, bc_weight) apply to electrodes and dielectric interfaces in both solvers.
Without PETSc, the algebraic multigrid fallback is not compiled, and amg_fallback is ignored with a warning. The fallback is also skipped on periodic domains, and when the EB stencils reach further than the coarse-fine interpolation radius, since algebraic multigrid does not support these.
Geometric and algebraic multigrid assemble the operator differently, so a solve that falls back gives a slightly different discrete solution.