IBAMR  IBAMR version 0.19.
Public Member Functions | Private Member Functions | List of all members
IBAMR::KrylovMobilitySolver Class Reference

#include <ibamr/KrylovMobilitySolver.h>

Inheritance diagram for IBAMR::KrylovMobilitySolver:
Inheritance graph
[legend]

Public Member Functions

 KrylovMobilitySolver (std::string object_name, SAMRAI::tbox::Pointer< IBAMR::INSStaggeredHierarchyIntegrator > navier_stokes_integrator, SAMRAI::tbox::Pointer< IBAMR::CIBStrategy > cib_strategy, SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db, std::string default_options_prefix, MPI_Comm petsc_comm=PETSC_COMM_WORLD)
 Constructor for mobility solver that employs the PETSc KSP solver framework. More...
 
virtual ~KrylovMobilitySolver ()
 Destructor. More...
 
void setKSPType (const std::string &ksp_type)
 Set the KSP type. More...
 
void setOptionsPrefix (const std::string &options_prefix)
 Set the options prefix used by this PETSc solver object. More...
 
const KSP & getPETScKSP () const
 Get the PETSc KSP object. More...
 
SAMRAI::tbox::Pointer< IBAMR::StaggeredStokesSolvergetStokesSolver () const
 Return the Stokes solver used in the preconditioner of the solver. More...
 
void setVelocityPoissonSpecifications (const SAMRAI::solv::PoissonSpecifications &u_problem_coefs)
 Set the PoissonSpecifications object used to specify the coefficients for the momentum equation in the incompressible Stokes operator. More...
 
void setPhysicalBoundaryHelper (SAMRAI::tbox::Pointer< IBAMR::StaggeredStokesPhysicalBoundaryHelper > bc_helper)
 Set the StokesSpecifications object and timestep size used to specify the coefficients for the time-dependent incompressible Stokes operator. More...
 
void setPhysicalBcCoefs (const std::vector< SAMRAI::solv::RobinBcCoefStrategy< NDIM > * > &u_bc_coefs, SAMRAI::solv::RobinBcCoefStrategy< NDIM > *p_bc_coef)
 Set the SAMRAI::solv::RobinBcCoefStrategy objects used to specify physical boundary conditions. More...
 
bool solveSystem (Vec x, Vec b)
 Solve the linear system of equations \( Mx=b \) for \( x \). More...
 
void initializeSolverState (Vec x, Vec b)
 Compute hierarchy dependent data required for solving \( Mx = b \). More...
 
void deallocateSolverState ()
 Remove all hierarchy dependent data allocated by initializeSolverState(). More...
 
void setSolutionTime (double solution_time)
 Set the time at which the solution is to be evaluated. More...
 
void setTimeInterval (double current_time, double new_time)
 Set the current time interval. More...
 
void setInterpScale (const double scale_interp)
 Set scale factor for interp operator. More...
 
void setSpreadScale (const double scale_spread)
 Set scale factor for spread operator. More...
 
void setRegularizeMobilityScale (const double scale_reg_mob)
 Set scale factor for regularizing mobility matrix. More...
 
void setNormalizeSpreadForce (const bool normalize_force)
 Set if the mean of the Lagrangian force is to be subtracted from the Eulerian force variable. More...
 

Private Member Functions

 KrylovMobilitySolver (const KrylovMobilitySolver &from)=delete
 Copy constructor. More...
 
KrylovMobilitySolveroperator= (const KrylovMobilitySolver &that)=delete
 Assignment operator. More...
 
void getFromInput (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db)
 Get solver settings from the input file. More...
 
void initializeStokesSolver (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &sol_vec, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &rhs_vec)
 Initialize the Stokes solver needed in the mobility matrix. More...
 
void initializeKSP ()
 Routine to setup KSP object. More...
 
void resetKSPOptions ()
 Reset the values of the convergence tolerances for the PETSc KSP object. More...
 
void resetKSPOperators ()
 Reset the KSP operators to correspond to the supplied LinearOperator. More...
 
void resetKSPPC ()
 Reset the KSP PC to correspond to the supplied preconditioner. More...
 
void destroyKSP ()
 Routine to destroy KSP object. More...
 

Static functions for use by PETSc KSP and MatShell objects.

std::string d_object_name
 
std::string d_ksp_type = KSPGMRES
 
std::string d_pc_type = "none"
 
bool d_is_initialized = false
 
bool d_reinitializing_solver = false
 
Vec d_petsc_x = nullptr
 
Vec d_petsc_b = nullptr
 
std::string d_options_prefix
 
MPI_Comm d_petsc_comm
 
KSP d_petsc_ksp = nullptr
 
Mat d_petsc_mat = nullptr
 
std::vector< SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, PetscScalar > > > d_samrai_temp
 
SAMRAI::tbox::Pointer< IBAMR::INSStaggeredHierarchyIntegratord_ins_integrator
 
SAMRAI::tbox::Pointer< IBAMR::CIBStrategyd_cib_strategy
 
SAMRAI::tbox::Pointer< IBAMR::StaggeredStokesSolverd_LInv
 
SAMRAI::tbox::Pointer< IBTK::PoissonSolverd_velocity_solver
 
SAMRAI::tbox::Pointer< IBTK::PoissonSolverd_pressure_solver
 
int d_max_iterations = 10000
 
int d_current_iterations
 
double d_abs_residual_tol = 1.0e-50
 
double d_rel_residual_tol = 1.0e-5
 
double d_current_residual_norm
 
bool d_initial_guess_nonzero = false
 
bool d_enable_logging = false
 
SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM > > d_hierarchy
 
std::vector< SAMRAI::solv::RobinBcCoefStrategy< NDIM > * > d_u_bc_coefs
 
SAMRAI::tbox::Pointer< SAMRAI::xfer::VariableFillPattern< NDIM > > d_fill_pattern
 
std::vector< IBTK::HierarchyGhostCellInterpolation::InterpolationTransactionComponentd_transaction_comps
 
SAMRAI::tbox::Pointer< IBTK::HierarchyGhostCellInterpolationd_hier_bdry_fill
 
std::vector< SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > > d_nul_vecs
 
std::vector< SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > > d_U_nul_vecs
 
bool d_normalize_pressure = false
 
bool d_normalize_velocity = false
 
double d_current_time = std::numeric_limits<double>::signaling_NaN()
 
double d_new_time = std::numeric_limits<double>::signaling_NaN()
 
double d_scale_interp = 1.0
 
double d_scale_spread = 1.0
 
double d_reg_mob_factor = 0.0
 
double d_normalize_spread_force
 
static PetscErrorCode MatVecMult_KMInv (Mat A, Vec x, Vec y)
 Compute the matrix vector product \(y=Ax\). More...
 
static PetscErrorCode PCApply_KMInv (PC pc, Vec x, Vec y)
 Apply the preconditioner to x and store the result in y. More...
 
static PetscErrorCode monitorKSP (KSP ksp, int it, PetscReal rnorm, void *mctx)
 Set KSP monitoring routine for the KSP. More...
 

Detailed Description

We are trying to solve the problem

\( Mx = [J L^{-1} S]x = b \); for \( x \).

Here, \( M \) is the mobility matrix, \( J \) is the interpolation operator, \( L \) is the Stokes operator, and \( S \) is the spreading operator.

Constructor & Destructor Documentation

◆ KrylovMobilitySolver() [1/2]

IBAMR::KrylovMobilitySolver::KrylovMobilitySolver ( std::string  object_name,
SAMRAI::tbox::Pointer< IBAMR::INSStaggeredHierarchyIntegrator navier_stokes_integrator,
SAMRAI::tbox::Pointer< IBAMR::CIBStrategy cib_strategy,
SAMRAI::tbox::Pointer< SAMRAI::tbox::Database input_db,
std::string  default_options_prefix,
MPI_Comm  petsc_comm = PETSC_COMM_WORLD 
)

◆ ~KrylovMobilitySolver()

virtual IBAMR::KrylovMobilitySolver::~KrylovMobilitySolver ( )
virtual

◆ KrylovMobilitySolver() [2/2]

IBAMR::KrylovMobilitySolver::KrylovMobilitySolver ( const KrylovMobilitySolver from)
privatedelete
Note
This constructor is not implemented and should not be used.
Parameters
fromThe value to copy to this object.

Member Function Documentation

◆ setKSPType()

void IBAMR::KrylovMobilitySolver::setKSPType ( const std::string &  ksp_type)

◆ setOptionsPrefix()

void IBAMR::KrylovMobilitySolver::setOptionsPrefix ( const std::string &  options_prefix)

◆ getPETScKSP()

const KSP& IBAMR::KrylovMobilitySolver::getPETScKSP ( ) const

◆ getStokesSolver()

SAMRAI::tbox::Pointer<IBAMR::StaggeredStokesSolver> IBAMR::KrylovMobilitySolver::getStokesSolver ( ) const

◆ setVelocityPoissonSpecifications()

void IBAMR::KrylovMobilitySolver::setVelocityPoissonSpecifications ( const SAMRAI::solv::PoissonSpecifications u_problem_coefs)

◆ setPhysicalBoundaryHelper()

void IBAMR::KrylovMobilitySolver::setPhysicalBoundaryHelper ( SAMRAI::tbox::Pointer< IBAMR::StaggeredStokesPhysicalBoundaryHelper bc_helper)

◆ setPhysicalBcCoefs()

void IBAMR::KrylovMobilitySolver::setPhysicalBcCoefs ( const std::vector< SAMRAI::solv::RobinBcCoefStrategy< NDIM > * > &  u_bc_coefs,
SAMRAI::solv::RobinBcCoefStrategy< NDIM > *  p_bc_coef 
)
Note
Any of the elements of u_bc_coefs may be nullptr. In this case, homogeneous Dirichlet boundary conditions are employed for that data depth. p_bc_coef may also be nullptr; in that case, homogeneous Neumann boundary conditions are employed for the pressure.
Parameters
u_bc_coefsVector of pointers to objects that can set the Robin boundary condition coefficients for the velocity.
p_bc_coefPointer to object that can set the Robin boundary condition coefficients for the pressure.

◆ solveSystem()

bool IBAMR::KrylovMobilitySolver::solveSystem ( Vec  x,
Vec  b 
)
Parameters
xsolution vector
bright-hand-side vector
Returns
true if the solver converged to the specified tolerances, false otherwise

◆ initializeSolverState()

void IBAMR::KrylovMobilitySolver::initializeSolverState ( Vec  x,
Vec  b 
)
Parameters
xsolution vector
bright-hand-side vector

◆ deallocateSolverState()

void IBAMR::KrylovMobilitySolver::deallocateSolverState ( )
Note
It is safe to call deallocateSolverState() when the solver state is already deallocated.
See also
initializeSolverState

◆ setSolutionTime()

void IBAMR::KrylovMobilitySolver::setSolutionTime ( double  solution_time)

◆ setTimeInterval()

void IBAMR::KrylovMobilitySolver::setTimeInterval ( double  current_time,
double  new_time 
)

◆ setInterpScale()

void IBAMR::KrylovMobilitySolver::setInterpScale ( const double  scale_interp)

◆ setSpreadScale()

void IBAMR::KrylovMobilitySolver::setSpreadScale ( const double  scale_spread)

◆ setRegularizeMobilityScale()

void IBAMR::KrylovMobilitySolver::setRegularizeMobilityScale ( const double  scale_reg_mob)

◆ setNormalizeSpreadForce()

void IBAMR::KrylovMobilitySolver::setNormalizeSpreadForce ( const bool  normalize_force)
Note
This operation is needed for certain situations like Stokes flow with periodic BCs.

◆ operator=()

KrylovMobilitySolver& IBAMR::KrylovMobilitySolver::operator= ( const KrylovMobilitySolver that)
privatedelete
Note
This operator is not implemented and should not be used.
Parameters
thatThe value to assign to this object.
Returns
A reference to this object.

◆ getFromInput()

void IBAMR::KrylovMobilitySolver::getFromInput ( SAMRAI::tbox::Pointer< SAMRAI::tbox::Database input_db)
private

◆ initializeStokesSolver()

void IBAMR::KrylovMobilitySolver::initializeStokesSolver ( const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  sol_vec,
const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  rhs_vec 
)
private

◆ initializeKSP()

void IBAMR::KrylovMobilitySolver::initializeKSP ( )
private

◆ resetKSPOptions()

void IBAMR::KrylovMobilitySolver::resetKSPOptions ( )
private

◆ resetKSPOperators()

void IBAMR::KrylovMobilitySolver::resetKSPOperators ( )
private

◆ resetKSPPC()

void IBAMR::KrylovMobilitySolver::resetKSPPC ( )
private

◆ destroyKSP()

void IBAMR::KrylovMobilitySolver::destroyKSP ( )
private

◆ MatVecMult_KMInv()

static PetscErrorCode IBAMR::KrylovMobilitySolver::MatVecMult_KMInv ( Mat  A,
Vec  x,
Vec  y 
)
staticprivate

◆ PCApply_KMInv()

static PetscErrorCode IBAMR::KrylovMobilitySolver::PCApply_KMInv ( PC  pc,
Vec  x,
Vec  y 
)
staticprivate

◆ monitorKSP()

static PetscErrorCode IBAMR::KrylovMobilitySolver::monitorKSP ( KSP  ksp,
int  it,
PetscReal  rnorm,
void *  mctx 
)
staticprivate

Member Data Documentation

◆ d_object_name

std::string IBAMR::KrylovMobilitySolver::d_object_name
private

◆ d_ksp_type

std::string IBAMR::KrylovMobilitySolver::d_ksp_type = KSPGMRES
private

◆ d_pc_type

std::string IBAMR::KrylovMobilitySolver::d_pc_type = "none"
private

◆ d_is_initialized

bool IBAMR::KrylovMobilitySolver::d_is_initialized = false
private

◆ d_reinitializing_solver

bool IBAMR::KrylovMobilitySolver::d_reinitializing_solver = false
private

◆ d_petsc_x

Vec IBAMR::KrylovMobilitySolver::d_petsc_x = nullptr
private

◆ d_petsc_b

Vec IBAMR::KrylovMobilitySolver::d_petsc_b = nullptr
private

◆ d_options_prefix

std::string IBAMR::KrylovMobilitySolver::d_options_prefix
private

◆ d_petsc_comm

MPI_Comm IBAMR::KrylovMobilitySolver::d_petsc_comm
private

◆ d_petsc_ksp

KSP IBAMR::KrylovMobilitySolver::d_petsc_ksp = nullptr
private

◆ d_petsc_mat

Mat IBAMR::KrylovMobilitySolver::d_petsc_mat = nullptr
private

◆ d_samrai_temp

std::vector<SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, PetscScalar> > > IBAMR::KrylovMobilitySolver::d_samrai_temp
private

◆ d_ins_integrator

SAMRAI::tbox::Pointer<IBAMR::INSStaggeredHierarchyIntegrator> IBAMR::KrylovMobilitySolver::d_ins_integrator
private

◆ d_cib_strategy

SAMRAI::tbox::Pointer<IBAMR::CIBStrategy> IBAMR::KrylovMobilitySolver::d_cib_strategy
private

◆ d_LInv

SAMRAI::tbox::Pointer<IBAMR::StaggeredStokesSolver> IBAMR::KrylovMobilitySolver::d_LInv
private

◆ d_velocity_solver

SAMRAI::tbox::Pointer<IBTK::PoissonSolver> IBAMR::KrylovMobilitySolver::d_velocity_solver
private

◆ d_pressure_solver

SAMRAI::tbox::Pointer<IBTK::PoissonSolver> IBAMR::KrylovMobilitySolver::d_pressure_solver
private

◆ d_max_iterations

int IBAMR::KrylovMobilitySolver::d_max_iterations = 10000
private

◆ d_current_iterations

int IBAMR::KrylovMobilitySolver::d_current_iterations
private

◆ d_abs_residual_tol

double IBAMR::KrylovMobilitySolver::d_abs_residual_tol = 1.0e-50
private

◆ d_rel_residual_tol

double IBAMR::KrylovMobilitySolver::d_rel_residual_tol = 1.0e-5
private

◆ d_current_residual_norm

double IBAMR::KrylovMobilitySolver::d_current_residual_norm
private

◆ d_initial_guess_nonzero

bool IBAMR::KrylovMobilitySolver::d_initial_guess_nonzero = false
private

◆ d_enable_logging

bool IBAMR::KrylovMobilitySolver::d_enable_logging = false
private

◆ d_hierarchy

SAMRAI::tbox::Pointer<SAMRAI::hier::PatchHierarchy<NDIM> > IBAMR::KrylovMobilitySolver::d_hierarchy
private

◆ d_u_bc_coefs

std::vector<SAMRAI::solv::RobinBcCoefStrategy<NDIM>*> IBAMR::KrylovMobilitySolver::d_u_bc_coefs
private

◆ d_fill_pattern

SAMRAI::tbox::Pointer<SAMRAI::xfer::VariableFillPattern<NDIM> > IBAMR::KrylovMobilitySolver::d_fill_pattern
private

◆ d_transaction_comps

std::vector<IBTK::HierarchyGhostCellInterpolation::InterpolationTransactionComponent> IBAMR::KrylovMobilitySolver::d_transaction_comps
private

◆ d_hier_bdry_fill

SAMRAI::tbox::Pointer<IBTK::HierarchyGhostCellInterpolation> IBAMR::KrylovMobilitySolver::d_hier_bdry_fill
private

◆ d_nul_vecs

std::vector<SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > > IBAMR::KrylovMobilitySolver::d_nul_vecs
private

◆ d_U_nul_vecs

std::vector<SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > > IBAMR::KrylovMobilitySolver::d_U_nul_vecs
private

◆ d_normalize_pressure

bool IBAMR::KrylovMobilitySolver::d_normalize_pressure = false
private

This boolean value determines whether the pressure is normalized to have zero mean (i.e., discrete integral) at the end of each timestep.

◆ d_normalize_velocity

bool IBAMR::KrylovMobilitySolver::d_normalize_velocity = false
private

This boolean value determines whether the velocity is normalized to have zero mean (i.e., discrete integral) at the end of each timestep.

This parameter only affects the case in which rho=0 (i.e. the steady Stokes equations).

◆ d_current_time

double IBAMR::KrylovMobilitySolver::d_current_time = std::numeric_limits<double>::signaling_NaN()
private

◆ d_new_time

double IBAMR::KrylovMobilitySolver::d_new_time = std::numeric_limits<double>::signaling_NaN()
private

◆ d_scale_interp

double IBAMR::KrylovMobilitySolver::d_scale_interp = 1.0
private

◆ d_scale_spread

double IBAMR::KrylovMobilitySolver::d_scale_spread = 1.0
private

◆ d_reg_mob_factor

double IBAMR::KrylovMobilitySolver::d_reg_mob_factor = 0.0
private

◆ d_normalize_spread_force

double IBAMR::KrylovMobilitySolver::d_normalize_spread_force
private

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