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

Class DirectMobilitySolver solves the mobility and body-mobility sub-problem by employing direct solvers.

#include <ibamr/DirectMobilitySolver.h>

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

Public Member Functions

 DirectMobilitySolver (std::string object_name, SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db, SAMRAI::tbox::Pointer< IBAMR::CIBStrategy > cib_strategy)
 The only constructor of this class. More...
 
virtual ~DirectMobilitySolver ()
 Destructor for this class. More...
 
void registerMobilityMat (const std::string &mat_name, const unsigned prototype_struct_id, MobilityMatrixType mat_type, std::pair< MobilityMatrixInverseType, MobilityMatrixInverseType > inv_type, const int managing_proc=0, const std::string &filename="", std::pair< double, double > scale=std::pair< double, double >(1.0, 0.0))
 Register a prototypical structure with a particular mobility matrix identified by its name. More...
 
void registerMobilityMat (const std::string &mat_name, const std::vector< unsigned > &prototype_struct_ids, MobilityMatrixType mat_type, std::pair< MobilityMatrixInverseType, MobilityMatrixInverseType > inv_type, const int managing_proc=0, const std::string &filename="", std::pair< double, double > scale=std::pair< double, double >(1.0, 0.0))
 Register mutiple prototype structures with a particular matrix identified by its name. A combined dense mobility matrix for all the associated prototypical structures will be formed. More...
 
void registerStructIDsWithMobilityMat (const std::string &mat_name, const std::vector< std::vector< unsigned > > &struct_ids)
 Register all structures that will be managed by this particular dense mobility matrix. More...
 
void initializeSolverState (Vec x, Vec b)
 Initialize the solver. More...
 
void deallocateSolverState ()
 Deallocate the solver. More...
 
void setSolutionTime (const double solution_time)
 Set the time at which the solution is to be evaluated. More...
 
void setTimeInterval (const double current_time, const double new_time)
 Set the time interval of integration. More...
 
void setStokesSpecifications (const IBAMR::StokesSpecifications &stokes_spec)
 Set stokes specifications. More...
 
bool solveSystem (Vec x, Vec b)
 Solves the mobility problem. More...
 
bool solveBodySystem (Vec x, Vec b)
 Solves the body mobility problem. More...
 
const std::vector< unsigned > & getPrototypeStructIDs (const std::string &mat_name)
 Return the ids of the structures associated with the dense mobility matrix formation. More...
 
const std::vector< std::vector< unsigned > > & getStructIDs (const std::string &mat_name)
 Return the ids of the structure associated with the dense mobility matrix. More...
 

Private Member Functions

void getFromInput (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db)
 Get input options. More...
 
void factorizeMobilityMatrix ()
 Factorize mobility matrix using direct solvers. More...
 
void constructBodyMobilityMatrix ()
 Construct body mobility matrix as N = K^T inv(M) K. More...
 
void factorizeBodyMobilityMatrix ()
 Factorize body mobility matrix using direct solvers. More...
 
void factorizeDenseMatrix (double *mat_data, const int mat_size, const MobilityMatrixInverseType &inv_type, int *ipiv, const std::string &mat_name, const std::string &err_msg)
 Factorize dense matrix. More...
 
void computeSolution (Mat &mat, const MobilityMatrixInverseType &inv_type, int *ipiv, double *rhs)
 Compute solution and store in the rhs vector. More...
 

Private Attributes

std::string d_object_name
 
bool d_is_initialized = false
 
double d_solution_time
 
double d_current_time
 
double d_new_time
 
SAMRAI::tbox::Pointer< IBAMR::CIBStrategyd_cib_strategy
 
std::map< std::string, std::pair< std::vector< double >, std::vector< double > > > d_mat_map
 
std::map< std::string, std::vector< double > > d_geometric_mat_map
 
std::map< std::string, intd_mat_proc_map
 
std::map< std::string, std::vector< unsigned > > d_mat_prototype_id_map
 
std::map< std::string, std::vector< std::vector< unsigned > > > d_mat_actual_id_map
 
std::map< std::string, MobilityMatrixTyped_mat_type_map
 
std::map< std::string, std::pair< MobilityMatrixInverseType, MobilityMatrixInverseType > > d_mat_inv_type_map
 
std::map< std::string, unsigned intd_mat_nodes_map
 
std::map< std::string, unsigned intd_mat_parts_map
 
std::map< std::string, std::pair< double, double > > d_mat_scale_map
 
std::map< std::string, std::string > d_mat_filename_map
 
std::map< std::string, std::pair< std::vector< int >, std::vector< int > > > d_ipiv_map
 
std::map< std::string, std::pair< Mat, Mat > > d_petsc_mat_map
 
std::map< std::string, Mat > d_petsc_geometric_mat_map
 
double d_mu
 
double d_rho
 
double d_f_periodic_corr = 0.0
 
bool d_recompute_mob_mat = false
 
double d_svd_replace_value
 
double d_svd_eps
 

Constructor & Destructor Documentation

◆ DirectMobilitySolver()

IBAMR::DirectMobilitySolver::DirectMobilitySolver ( std::string  object_name,
SAMRAI::tbox::Pointer< SAMRAI::tbox::Database input_db,
SAMRAI::tbox::Pointer< IBAMR::CIBStrategy cib_strategy 
)

◆ ~DirectMobilitySolver()

virtual IBAMR::DirectMobilitySolver::~DirectMobilitySolver ( )
virtual

Member Function Documentation

◆ registerMobilityMat() [1/2]

void IBAMR::DirectMobilitySolver::registerMobilityMat ( const std::string &  mat_name,
const unsigned  prototype_struct_id,
MobilityMatrixType  mat_type,
std::pair< MobilityMatrixInverseType, MobilityMatrixInverseType inv_type,
const int  managing_proc = 0,
const std::string &  filename = "",
std::pair< double, double scale = std::pair< doubledouble >(1.0, 0.0) 
)
Parameters
mat_nameMatrix handle.
prototype_struct_idPrototypical structure id as defined while registering structures with IBAMR::IBStrategy class.
mat_typeMatrix type to be used for dense mobility matrix.
inv_typeInversion method to be used for the mobility and body-mobility matrix.
filenameIf the mobility matrix is to be read from an input file.
Note
The current implementation supports only binary files from PETSc I/O.
Parameters
scaleScale for improving the conditioning number of dense mobility matrix. The matrix is scaled as \( [MM] = \alpha*[MM] + \beta*[I]. \)
managing_procMPI processor that manages this mobility matrix.

◆ registerMobilityMat() [2/2]

void IBAMR::DirectMobilitySolver::registerMobilityMat ( const std::string &  mat_name,
const std::vector< unsigned > &  prototype_struct_ids,
MobilityMatrixType  mat_type,
std::pair< MobilityMatrixInverseType, MobilityMatrixInverseType inv_type,
const int  managing_proc = 0,
const std::string &  filename = "",
std::pair< double, double scale = std::pair< doubledouble >(1.0, 0.0) 
)
Parameters
mat_nameMatrix handle.
prototype_struct_idsVector of prototypical structure ids as defined while registering structures with IBAMR::IBStrategy class.
mat_typeMatrix type to be used for dense mobility matrix.
inv_typeInversion method to be used for the mobility and body-mobility matrix.
filenameIf the mobility matrix is to be read from an input file.
Note
The current implementation supports only binary files from PETSc I/O.
Parameters
scaleScale for improving the conditioning number of dense mobility matrix. The matrix is scaled as \( [MM] = \alpha*[MM] + \beta*[I]. \)
managing_procMPI processor that manages this mobility matrix.

◆ registerStructIDsWithMobilityMat()

void IBAMR::DirectMobilitySolver::registerStructIDsWithMobilityMat ( const std::string &  mat_name,
const std::vector< std::vector< unsigned > > &  struct_ids 
)
Note
This function should be called after all the mobility matrices have been registered with a particular processor.

◆ initializeSolverState()

void IBAMR::DirectMobilitySolver::initializeSolverState ( Vec  x,
Vec  b 
)

◆ deallocateSolverState()

void IBAMR::DirectMobilitySolver::deallocateSolverState ( )

◆ setSolutionTime()

void IBAMR::DirectMobilitySolver::setSolutionTime ( const double  solution_time)

◆ setTimeInterval()

void IBAMR::DirectMobilitySolver::setTimeInterval ( const double  current_time,
const double  new_time 
)

◆ setStokesSpecifications()

void IBAMR::DirectMobilitySolver::setStokesSpecifications ( const IBAMR::StokesSpecifications stokes_spec)

◆ solveSystem()

bool IBAMR::DirectMobilitySolver::solveSystem ( Vec  x,
Vec  b 
)
Parameters
xVec storing the Lagrange multiplier.
bVec storing the desired velocity.
Returns
true if the solver converged to the specified tolerances, false otherwise.

◆ solveBodySystem()

bool IBAMR::DirectMobilitySolver::solveBodySystem ( Vec  x,
Vec  b 
)
Parameters
xVec storing the rigid body center of mass translational and rotational velocity.
bVec storing the applied external force.
Returns
true if the solver converged to the specified tolerances, false otherwise.

◆ getPrototypeStructIDs()

const std::vector<unsigned>& IBAMR::DirectMobilitySolver::getPrototypeStructIDs ( const std::string &  mat_name)
Parameters
mat_nameMatrix handle.
Returns
Vector of structure ids used to form the mobility matrix.

◆ getStructIDs()

const std::vector<std::vector<unsigned> >& IBAMR::DirectMobilitySolver::getStructIDs ( const std::string &  mat_name)
Parameters
mat_nameMatrix handle.
Returns
Vector of structure ids associated with the mobility matrix.

◆ getFromInput()

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

◆ factorizeMobilityMatrix()

void IBAMR::DirectMobilitySolver::factorizeMobilityMatrix ( )
private

◆ constructBodyMobilityMatrix()

void IBAMR::DirectMobilitySolver::constructBodyMobilityMatrix ( )
private

◆ factorizeBodyMobilityMatrix()

void IBAMR::DirectMobilitySolver::factorizeBodyMobilityMatrix ( )
private

◆ factorizeDenseMatrix()

void IBAMR::DirectMobilitySolver::factorizeDenseMatrix ( double mat_data,
const int  mat_size,
const MobilityMatrixInverseType inv_type,
int ipiv,
const std::string &  mat_name,
const std::string &  err_msg 
)
private

◆ computeSolution()

void IBAMR::DirectMobilitySolver::computeSolution ( Mat &  mat,
const MobilityMatrixInverseType inv_type,
int ipiv,
double rhs 
)
private

Member Data Documentation

◆ d_object_name

std::string IBAMR::DirectMobilitySolver::d_object_name
private

◆ d_is_initialized

bool IBAMR::DirectMobilitySolver::d_is_initialized = false
private

◆ d_solution_time

double IBAMR::DirectMobilitySolver::d_solution_time
private

◆ d_current_time

double IBAMR::DirectMobilitySolver::d_current_time
private

◆ d_new_time

double IBAMR::DirectMobilitySolver::d_new_time
private

◆ d_cib_strategy

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

◆ d_mat_map

std::map<std::string, std::pair<std::vector<double>, std::vector<double> > > IBAMR::DirectMobilitySolver::d_mat_map
private

◆ d_geometric_mat_map

std::map<std::string, std::vector<double> > IBAMR::DirectMobilitySolver::d_geometric_mat_map
private

◆ d_mat_proc_map

std::map<std::string, int> IBAMR::DirectMobilitySolver::d_mat_proc_map
private

◆ d_mat_prototype_id_map

std::map<std::string, std::vector<unsigned> > IBAMR::DirectMobilitySolver::d_mat_prototype_id_map
private

◆ d_mat_actual_id_map

std::map<std::string, std::vector<std::vector<unsigned> > > IBAMR::DirectMobilitySolver::d_mat_actual_id_map
private

◆ d_mat_type_map

std::map<std::string, MobilityMatrixType> IBAMR::DirectMobilitySolver::d_mat_type_map
private

◆ d_mat_inv_type_map

std::map<std::string, std::pair<MobilityMatrixInverseType, MobilityMatrixInverseType> > IBAMR::DirectMobilitySolver::d_mat_inv_type_map
private

◆ d_mat_nodes_map

std::map<std::string, unsigned int> IBAMR::DirectMobilitySolver::d_mat_nodes_map
private

◆ d_mat_parts_map

std::map<std::string, unsigned int> IBAMR::DirectMobilitySolver::d_mat_parts_map
private

◆ d_mat_scale_map

std::map<std::string, std::pair<double, double> > IBAMR::DirectMobilitySolver::d_mat_scale_map
private

◆ d_mat_filename_map

std::map<std::string, std::string> IBAMR::DirectMobilitySolver::d_mat_filename_map
private

◆ d_ipiv_map

std::map<std::string, std::pair<std::vector<int>, std::vector<int> > > IBAMR::DirectMobilitySolver::d_ipiv_map
private

◆ d_petsc_mat_map

std::map<std::string, std::pair<Mat, Mat> > IBAMR::DirectMobilitySolver::d_petsc_mat_map
private

◆ d_petsc_geometric_mat_map

std::map<std::string, Mat> IBAMR::DirectMobilitySolver::d_petsc_geometric_mat_map
private

◆ d_mu

double IBAMR::DirectMobilitySolver::d_mu
private

◆ d_rho

double IBAMR::DirectMobilitySolver::d_rho
private

◆ d_f_periodic_corr

double IBAMR::DirectMobilitySolver::d_f_periodic_corr = 0.0
private

◆ d_recompute_mob_mat

bool IBAMR::DirectMobilitySolver::d_recompute_mob_mat = false
private

◆ d_svd_replace_value

double IBAMR::DirectMobilitySolver::d_svd_replace_value
private

◆ d_svd_eps

double IBAMR::DirectMobilitySolver::d_svd_eps
private

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