IBAMR
An adaptive and distributed-memory parallel implementation of the immersed boundary (IB) method
Public Member Functions | List of all members
IBTK::PoissonFACPreconditionerStrategy Class Referenceabstract

Class PoissonFACPreconditionerStrategy is an abstract FACPreconditionerStrategy implementing many of the operations required by smoothers for the Poisson equation and related problems. More...

#include </home/runner/work/IBAMR/IBAMR/ibtk/include/ibtk/PoissonFACPreconditionerStrategy.h>

Inheritance diagram for IBTK::PoissonFACPreconditionerStrategy:
Inheritance graph
[legend]

Public Member Functions

 PoissonFACPreconditionerStrategy (std::string object_name, SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM > > scratch_var, int ghost_cell_width, SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db, const std::string &default_options_prefix)
 Constructor.
 
 ~PoissonFACPreconditionerStrategy ()
 Destructor.
 
virtual void setPoissonSpecifications (const SAMRAI::solv::PoissonSpecifications &poisson_spec)
 Set the SAMRAI::solv::PoissonSpecifications object used to specify the coefficients for the scalar-valued or vector-valued Laplace operator.
 
virtual void setPhysicalBcCoef (SAMRAI::solv::RobinBcCoefStrategy< NDIM > *bc_coef)
 Set the SAMRAI::solv::RobinBcCoefStrategy object used to specify physical boundary conditions. More...
 
virtual void setPhysicalBcCoefs (const std::vector< SAMRAI::solv::RobinBcCoefStrategy< NDIM > * > &bc_coefs)
 Set the SAMRAI::solv::RobinBcCoefStrategy objects used to specify physical boundary conditions. More...
 
Functions for configuring the solver.
void setResetLevels (int coarsest_ln, int finest_ln)
 Specify the levels that need to be reset the next time the operator is re-initialized. More...
 
virtual void setSmootherType (const std::string &smoother_type)=0
 Specify the smoother type.
 
virtual void setCoarseSolverType (const std::string &coarse_solver_type)=0
 Specify the coarse level solver.
 
void setCoarseSolverMaxIterations (int coarse_solver_max_iterations)
 Set the maximum number of iterations for the coarse level solve. More...
 
void setCoarseSolverAbsoluteTolerance (double coarse_solver_abs_residual_tol)
 Set the absolute residual tolerance for convergence for coarse level solve. More...
 
void setCoarseSolverRelativeTolerance (double coarse_solver_rel_residual_tol)
 Set the relative residual tolerance for convergence for coarse level solve. More...
 
void setProlongationMethod (const std::string &prolongation_method)
 Set the name of the prolongation method.
 
void setRestrictionMethod (const std::string &restriction_method)
 Set the name of the restriction method.
 
- Public Member Functions inherited from IBTK::FACPreconditionerStrategy
 FACPreconditionerStrategy (std::string object_name, bool homogeneous_bc=false)
 Constructor.
 
virtual ~FACPreconditionerStrategy ()=default
 Empty virtual desctructor.
 
const std::stringgetName () const
 Return the object name.
 
virtual bool getIsInitialized () const
 Return whether the operator is initialized.
 
virtual void setFACPreconditioner (SAMRAI::tbox::ConstPointer< FACPreconditioner > preconditioner)
 Method to allow the FACPreconditioner object to register itself with the concrete FACPreconditionerStrategy.
 
virtual void setHomogeneousBc (bool homogeneous_bc)
 Set whether the solver should use homogeneous boundary conditions.
 
virtual bool getHomogeneousBc () const
 Return whether the solver is using homogeneous boundary conditions.
 
virtual void setSolutionTime (double solution_time)
 Set the time at which the solution is to be evaluated.
 
virtual double getSolutionTime () const
 Get the time at which the solution is being evaluated.
 
virtual void setTimeInterval (double current_time, double new_time)
 Set the current time interval.
 
virtual std::pair< double, double > getTimeInterval () const
 Get the current time interval.
 
virtual double getDt () const
 Get the current time step size.
 
virtual void smoothError (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &error, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &residual, int level_num, int num_sweeps, bool performing_pre_sweeps, bool performing_post_sweeps)=0
 Smooth the error by the specified number of sweeps on the specified level of the patch hierarchy.
 
virtual bool solveCoarsestLevel (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &error, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &residual, int coarsest_level_num)=0
 Solve the system of equations on the coarsest level of the patch hierarchy. More...
 
virtual void computeResidual (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &residual, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &solution, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &rhs, int coarsest_level_num, int finest_level_num)=0
 Compute the composite-grid residual on the specified range of levels of the patch hierarchy.
 
virtual void allocateScratchData ()
 Allocate scratch data.
 
virtual void deallocateScratchData ()
 Deallocate scratch data.
 
virtual void printClassData (std::ostream &stream)
 Print class data to stream.
 

Protected Attributes

Hierarchy-dependent objects.
SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > d_solution
 
SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > d_rhs
 
SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM > > d_hierarchy
 
int d_coarsest_ln = IBTK::invalid_level_number
 
int d_finest_ln = IBTK::invalid_level_number
 
std::vector< SAMRAI::tbox::Pointer< SAMRAI::math::HierarchyDataOpsReal< NDIM, double > > > d_level_data_ops
 
std::vector< SAMRAI::tbox::Pointer< IBTK::HierarchyGhostCellInterpolation > > d_level_bdry_fill_ops
 
std::vector< SAMRAI::tbox::Pointer< IBTK::HierarchyMathOps > > d_level_math_ops
 
bool d_in_initialize_operator_state = false
 
int d_coarsest_reset_ln = IBTK::invalid_level_number
 
int d_finest_reset_ln = IBTK::invalid_level_number
 
Solver configuration variables.
std::string d_smoother_type = "DEFAULT"
 
std::string d_prolongation_method = "DEFAULT"
 
std::string d_restriction_method = "DEFAULT"
 
std::string d_coarse_solver_type = "DEFAULT"
 
std::string d_coarse_solver_default_options_prefix
 
double d_coarse_solver_rel_residual_tol = 1.0e-5
 
double d_coarse_solver_abs_residual_tol = 1.0e-50
 
int d_coarse_solver_max_iterations = 10
 
Internal context and scratch data.
SAMRAI::tbox::Pointer< SAMRAI::hier::VariableContextd_context
 
int d_scratch_idx = IBTK::invalid_index
 
- Protected Attributes inherited from IBTK::FACPreconditionerStrategy
SAMRAI::tbox::ConstPointer< IBTK::FACPreconditionerd_preconditioner
 
const std::string d_object_name
 
bool d_is_initialized = false
 
bool d_homogeneous_bc
 
double d_solution_time = std::numeric_limits<double>::quiet_NaN()
 
double d_current_time = std::numeric_limits<double>::quiet_NaN()
 
double d_new_time = std::numeric_limits<double>::quiet_NaN()
 

Methods for executing, caching, and resetting communication

schedules.

SAMRAI::solv::PoissonSpecifications d_poisson_spec
 
std::unique_ptr< SAMRAI::solv::RobinBcCoefStrategy< NDIM > > d_default_bc_coef
 
std::vector< SAMRAI::solv::RobinBcCoefStrategy< NDIM > * > d_bc_coefs
 
SAMRAI::hier::IntVector< NDIM > d_gcw
 
void xeqScheduleProlongation (int dst_idx, int src_idx, int dst_ln)
 Execute a refinement schedule for prolonging data.
 
void xeqScheduleRestriction (int dst_idx, int src_idx, int dst_ln)
 Execute schedule for restricting solution or residual to the specified level.
 
void xeqScheduleGhostFillNoCoarse (int dst_idx, int dst_ln)
 Execute schedule for filling ghosts on the specified level.
 
void xeqScheduleDataSynch (int dst_idx, int dst_ln)
 Execute schedule for synchronizing data on the specified level.
 

Various refine and coarsen objects.

SAMRAI::tbox::Pointer< RobinPhysBdryPatchStrategyd_bc_op
 
SAMRAI::tbox::Pointer< CoarseFineBoundaryRefinePatchStrategyd_cf_bdry_op
 
SAMRAI::tbox::Pointer< SAMRAI::xfer::VariableFillPattern< NDIM > > d_op_stencil_fill_pattern
 
SAMRAI::tbox::Pointer< SAMRAI::xfer::VariableFillPattern< NDIM > > d_synch_fill_pattern
 

Partial implementation of FACPreconditionerStrategy interface.

void setToZero (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &vec, int level_num) override
 Zero the supplied vector.
 
void restrictResidual (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &src, SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &dst, int dst_ln) override
 Restrict the residual quantity to the specified level from the next finer level. More...
 
void prolongError (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &src, SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &dst, int dst_ln) override
 Prolong the error quantity to the specified level from the next coarser level. More...
 
void prolongErrorAndCorrect (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &src, SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &dst, int dst_ln) override
 Prolong the error quantity to the specified level from the next coarser level and apply the correction to the fine-level error. More...
 
void initializeOperatorState (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &solution, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &rhs) override
 Compute hierarchy-dependent data. More...
 
void deallocateOperatorState () override
 Remove all hierarchy-dependent data. More...
 
virtual void initializeOperatorStateSpecialized (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &solution, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &rhs, int coarsest_reset_ln, int finest_reset_ln)=0
 Compute implementation-specific hierarchy-dependent data.
 
virtual void deallocateOperatorStateSpecialized (int coarsest_reset_ln, int finest_reset_ln)=0
 Remove implementation-specific hierarchy-dependent data.
 

Additional Inherited Members

- Protected Member Functions inherited from IBTK::FACPreconditionerStrategy
virtual SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > getLevelSAMRAIVectorReal (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &vec, int level_num) const
 Return a SAMRAIVectorReal object that corresponds to the given object but restricted to a single level of the patch hierarchy.
 

Detailed Description

Class PoissonFACPreconditionerStrategy is an abstract FACPreconditionerStrategy implementing many of the operations required by smoothers for the Poisson equation and related problems.

The parameter ghost_cell_width is the necessary ghost cell width for all operations required by this class and derived classes. Such operations includes restricting, prolongation, computing residuals, and smoothing error. The patch indices in the RHS vector must have ghost cell widths that are equal to this parameter.

Sample parameters for initialization from database (and their default values):

smoother_type = "DEFAULT"                    // see setSmootherType()
prolongation_method = "DEFAULT"              // see setProlongationMethod()
restriction_method = "DEFAULT"               // see setRestrictionMethod()
coarse_solver_type = "DEFAULT"               // see setCoarseSolverType()
coarse_solver_rel_residual_tol = 1.0e-5      // see setCoarseSolverRelativeTolerance()
coarse_solver_abs_residual_tol = 1.0e-50     // see setCoarseSolverAbsoluteTolerance()
coarse_solver_max_iterations = 10            // see setCoarseSolverMaxIterations()

Member Function Documentation

◆ deallocateOperatorState()

void IBTK::PoissonFACPreconditionerStrategy::deallocateOperatorState ( )
overridevirtual

Remove all hierarchy-dependent data.

Remove all hierarchy-dependent data set by initializeOperatorState().

See also
initializeOperatorState

Reimplemented from IBTK::FACPreconditionerStrategy.

◆ initializeOperatorState()

void IBTK::PoissonFACPreconditionerStrategy::initializeOperatorState ( const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  solution,
const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  rhs 
)
overridevirtual

Compute hierarchy-dependent data.

Note that although the vector arguments given to other methods in this class may not necessarily be the same as those given to this method, there will be similarities, including:

  • hierarchy configuration (hierarchy pointer and level range)
  • number, type and alignment of vector component data
  • ghost cell width of data in the solution (or solution-like) vector

An unrecoverable error will occur if the rhs vector does not have consistent ghost cell width as that provided in the constructor.

Parameters
solutionsolution vector u
rhsright hand side vector f

Reimplemented from IBTK::FACPreconditionerStrategy.

◆ prolongError()

void IBTK::PoissonFACPreconditionerStrategy::prolongError ( const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  src,
SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  dst,
int  dst_ln 
)
overridevirtual

Prolong the error quantity to the specified level from the next coarser level.

Parameters
srcsource error vector
dstdestination error vector
dst_lndestination level number of data transfer

Implements IBTK::FACPreconditionerStrategy.

◆ prolongErrorAndCorrect()

void IBTK::PoissonFACPreconditionerStrategy::prolongErrorAndCorrect ( const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  src,
SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  dst,
int  dst_ln 
)
overridevirtual

Prolong the error quantity to the specified level from the next coarser level and apply the correction to the fine-level error.

Parameters
srcsource error vector
dstdestination error vector
dst_lndestination level number of data transfer

Implements IBTK::FACPreconditionerStrategy.

◆ restrictResidual()

void IBTK::PoissonFACPreconditionerStrategy::restrictResidual ( const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  src,
SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  dst,
int  dst_ln 
)
overridevirtual

Restrict the residual quantity to the specified level from the next finer level.

Parameters
srcsource residual
dstdestination residual
dst_lndestination level number

Implements IBTK::FACPreconditionerStrategy.

Reimplemented in IBTK::VCSCViscousOpPointRelaxationFACOperator.

◆ setCoarseSolverAbsoluteTolerance()

void IBTK::PoissonFACPreconditionerStrategy::setCoarseSolverAbsoluteTolerance ( double  coarse_solver_abs_residual_tol)

Set the absolute residual tolerance for convergence for coarse level solve.

If the coarse level solver uses a absolute convergence tolerance parameter, the specified value is used. If the coarse level solver does not use such a stopping parameter, implementations are free to ignore this value.

◆ setCoarseSolverMaxIterations()

void IBTK::PoissonFACPreconditionerStrategy::setCoarseSolverMaxIterations ( int  coarse_solver_max_iterations)

Set the maximum number of iterations for the coarse level solve.

If the coarse level solver uses a maximum number of iterations parameter, the specified value is used. If the coarse level solver does not use such a stopping parameter, implementations are free to ignore this value.

◆ setCoarseSolverRelativeTolerance()

void IBTK::PoissonFACPreconditionerStrategy::setCoarseSolverRelativeTolerance ( double  coarse_solver_rel_residual_tol)

Set the relative residual tolerance for convergence for coarse level solve.

If the coarse level solver uses a relative convergence tolerance parameter, the specified value is used. If the coarse level solver does not use such a stopping parameter, implementations are free to ignore this value.

◆ setPhysicalBcCoef()

void IBTK::PoissonFACPreconditionerStrategy::setPhysicalBcCoef ( SAMRAI::solv::RobinBcCoefStrategy< NDIM > *  bc_coef)
virtual

Set the SAMRAI::solv::RobinBcCoefStrategy object used to specify physical boundary conditions.

Note
bc_coef may be NULL. In this case, default boundary conditions (as supplied to the class constructor) are employed.
Parameters
bc_coefPointer to an object that can set the Robin boundary condition coefficients

◆ setPhysicalBcCoefs()

void IBTK::PoissonFACPreconditionerStrategy::setPhysicalBcCoefs ( const std::vector< SAMRAI::solv::RobinBcCoefStrategy< NDIM > * > &  bc_coefs)
virtual

Set the SAMRAI::solv::RobinBcCoefStrategy objects used to specify physical boundary conditions.

Note
Any of the elements of bc_coefs may be NULL. In this case, default boundary conditions (as supplied to the class constructor) are employed for that data depth.
Parameters
bc_coefsVector of pointers to objects that can set the Robin boundary condition coefficients

◆ setResetLevels()

void IBTK::PoissonFACPreconditionerStrategy::setResetLevels ( int  coarsest_ln,
int  finest_ln 
)

Specify the levels that need to be reset the next time the operator is re-initialized.

When the operator is initialized, then only the specified range of levels are reset in the operator state the next time that the operator is initialized. If the operator is not initialized, this method has no effect.

To ensure the range of levels that is reset includes all levels in the patch hierarchy, use coarsest_ln = finest_ln = -1.

Note
This function is used to save some unnecessary computations when the hierarchy is regridded. The range of levels specified must include all levels which need to be reset by SAMRAI::mesh::StandardTagAndInitStrategy::resetHierarchyConfiguration(). Any data residing outside of this range of levels will not be reset. This is not what you want to have happen if, for instance, the Poisson specifications changes.

The documentation for this class was generated from the following files: