35 namespace Pseudo_Elastic_Preconditioner_Subsidiary_Operator_Helper
73#ifdef OOMPH_HAS_TRILINOS
99 prec_pt->solver_pt()->disable_doc_time();
123 std::ostringstream error_message;
124 error_message <<
"The elastic mesh must be set.";
130 std::ostringstream error_message;
131 error_message <<
"The Lagrange multiplier mesh must be set.";
162 std::ostringstream error_message;
163 error_message <<
"This preconditioner requires DIM*3 types of DOF";
178 std::ostringstream error_message;
179 error_message <<
"FSIPreconditioner only works with"
180 <<
" CRDoubleMatrix matrices" << std::endl;
273 for (
unsigned d = 0; d <
Dim; d++)
301 std::ostringstream error_message;
302 error_message <<
"The diagonal entry for the constained block("
304 <<
"on local row " <<
i <<
" does not exist."
334 s_prec_pt->turn_into_subsidiary_block_preconditioner(
339 s_prec_pt->set_subsidiary_preconditioner_function(
344 for (
unsigned d = 0; d <
Dim; d++)
395 <<
"There is no such block based preconditioner.\n"
396 <<
"Candidates are:\n"
397 <<
"PseudoElasticPreconditioner::Block_diagonal_preconditioner\n"
398 <<
"PseudoElasticPreconditioner::Block_upper_triangular_"
400 <<
"PseudoElasticPreconditioner::Block_lower_triangular_"
419 for (
unsigned d = 0; d <
Dim; d++)
426 s_prec_pt->turn_into_subsidiary_block_preconditioner(
431 s_prec_pt->set_subsidiary_preconditioner_function(
436 for (
unsigned d = 0; d <
Dim; d++)
465 for (
unsigned d = 0; d <
Dim; d++)
475 (*Lagrange_multiplier_subsidiary_preconditioner_function_pt)();
507 for (
unsigned d = 0; d <
Dim; d++)
538 for (
unsigned i = 0;
i <
sz;
i++)
561 std::ostringstream error_message;
562 error_message <<
"The elastic mesh must be set.";
568 std::ostringstream error_message;
569 error_message <<
"The Lagrange multiplier mesh must be set.";
596 std::ostringstream error_message;
597 error_message <<
"This preconditioner requires DIM*3 types of DOF";
612 std::ostringstream error_message;
613 error_message <<
"FSIPreconditioner only works with"
614 <<
" CRDoubleMatrix matrices" << std::endl;
668 s_prec_pt->set_subsidiary_preconditioner_function(
692 s_prec_pt->set_subsidiary_preconditioner_function(
703 s_prec_pt->use_block_diagonal_approximation();
706 s_prec_pt->use_upper_triangular_approximation();
709 s_prec_pt->use_lower_triangular_approximation();
722 for (
unsigned d = 0; d <
Dim; d++)
732 (*Lagrange_multiplier_subsidiary_preconditioner_function_pt)();
766 for (
unsigned d = 0; d <
Dim; d++)
797 for (
unsigned i = 0;
i <
sz;
i++)
822 std::ostringstream error_message;
824 <<
"This SUBSIDIARY preconditioner requires an even number of "
865 const bool want_block =
true;
936 for (
unsigned j = 0;
j <
i;
j++)
961 if (n_dof_types % 2 != 0)
963 std::ostringstream error_message;
964 error_message <<
"This preconditioner requires DIM*3 types of DOF";
975 for (
unsigned d = 0; d < dim; d++)
991 for (
unsigned d = 0; d < dim; d++)
1000 ->turn_into_subsidiary_block_preconditioner(
this,
dof_list);
1004 ->set_subsidiary_preconditioner_function(
1025 for (
unsigned j =
l;
j < u;
j++)
void return_block_vector(const unsigned &n, const DoubleVector &b, DoubleVector &v) const
Takes the n-th block ordered vector, b, and copies its entries to the appropriate entries in the natu...
unsigned ndof_types_in_mesh(const unsigned &i) const
Return the number of DOF types in mesh i. WARNING: This should only be used by the upper-most master ...
CRDoubleMatrix get_concatenated_block(const VectorMatrix< BlockSelector > &selected_block)
Returns a concatenation of the block matrices specified by the argument selected_block....
void get_block(const unsigned &i, const unsigned &j, CRDoubleMatrix &output_matrix, const bool &ignore_replacement_block=false) const
Put block (i,j) into output_matrix. This block accounts for any coarsening of dof types and any repla...
void clear_block_preconditioner_base()
Clears all BlockPreconditioner data. Called by the destructor and the block_setup(....
void get_block_vector(const unsigned &n, const DoubleVector &v, DoubleVector &b) const
Takes the naturally ordered vector, v and returns the n-th block vector, b. Here n is the block numbe...
bool is_master_block_preconditioner() const
Return true if this preconditioner is the master block preconditioner.
unsigned nblock_types() const
Return the number of block types.
void set_replacement_dof_block(const unsigned &block_i, const unsigned &block_j, CRDoubleMatrix *replacement_dof_block_pt)
Set replacement dof-level blocks. Only dof-level blocks can be set. This is important due to how the ...
void return_block_ordered_preconditioner_vector(const DoubleVector &w, DoubleVector &v) const
Takes the block ordered vector, w, and reorders it in natural order. Reordered vector is returned in ...
unsigned ndof_types() const
Return the total number of DOF types.
void setup_matrix_vector_product(MatrixVectorProduct *matvec_prod_pt, CRDoubleMatrix *block_pt, const Vector< unsigned > &block_col_indices)
Setup a matrix vector product. matvec_prod_pt is a pointer to the MatrixVectorProduct,...
void set_nmesh(const unsigned &n)
Specify the number of meshes required by this block preconditioner. Note: elements in different meshe...
CRDoubleMatrix * matrix_pt() const
Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*,...
virtual void block_setup()
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of f...
void set_mesh(const unsigned &i, const Mesh *const mesh_pt, const bool &allow_multiple_element_type_in_mesh=false)
Set the i-th mesh for this block preconditioner. Note: The method set_nmesh(...) must be called befor...
void get_block_ordered_preconditioner_vector(const DoubleVector &v, DoubleVector &w)
Given the naturally ordered vector, v, return the vector rearranged in block order in w....
A class for compressed row matrices. This is a distributable object.
unsigned nrow_local() const
access function for the num of local rows on this processor.
A vector in the mathematical sense, initially developed for linear algebra type applications....
double * values_pt()
access function to the underlying values
void clear()
wipes the DoubleVector
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
A preconditioner for performing inner iteration preconditioner solves. The template argument SOLVER s...
static OomphCommunicator * communicator_pt()
access to global communicator. This is the oomph-lib equivalent of MPI_COMM_WORLD
Matrix-based diagonal preconditioner.
Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product m...
An OomphLibError object which should be thrown when an run-time error is encountered....
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
void setup(DoubleMatrixBase *matrix_pt)
Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditio...
virtual const OomphCommunicator * comm_pt() const
Get function for comm pointer.
virtual void preconditioner_solve(const DoubleVector &r, DoubleVector &z)=0
Apply the preconditioner. Pure virtual generic interface function. This method should apply the preco...
void lagrange_multiplier_preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the lagrange multiplier subsidiary preconditioner.
Preconditioner * Elastic_preconditioner_pt
storage for the preconditioner for the solid system
Vector< Preconditioner * > Lagrange_multiplier_preconditioner_pt
lagrange multiplier preconditioner pt
void setup()
Broken assignment operator.
bool Use_inf_norm_of_s_scaling
boolean indicating whether the inf-norm of S should be used as scaling. Default = true;
SubsidiaryPreconditionerFctPt Elastic_subsidiary_preconditioner_function_pt
The solid subsidiary preconditioner function pointer.
Elastic_preconditioner_type E_preconditioner_type
An unsigned indicating which method should be used for preconditioning the solid component.
void elastic_preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the elastic subsidiary preconditioner.
double Scaling
The scaling. Defaults to infinity norm of S.
unsigned Dim
the dimension of the problem
@ Exact_block_preconditioner
@ Block_upper_triangular_preconditioner
@ Block_lower_triangular_preconditioner
@ Block_diagonal_preconditioner
SubsidiaryPreconditionerFctPt Lagrange_multiplier_subsidiary_preconditioner_function_pt
The Lagrange multiplier subsidary preconditioner function pointer.
Mesh * Elastic_mesh_pt
Pointer to the mesh containing the solid elements.
void clean_up_memory()
Clears the memory.
Mesh * Lagrange_multiplier_mesh_pt
Pointer to the mesh containing the Lagrange multiplier elements.
//////////////////////////////////////////////////////////////////////////// ////////////////////////...
///////////////////////////////////////////////////////////////////////////// ///////////////////////...
void preconditioner_solve(const DoubleVector &res, DoubleVector &z)
Apply preconditioner to r.
SubsidiaryPreconditionerFctPt Subsidiary_preconditioner_function_pt
The SubisidaryPreconditionerFctPt.
Vector< PseudoElasticPreconditionerSubsidiaryPreconditionerOld * > Diagonal_block_preconditioner_pt
Vector of SuperLU preconditioner pointers for storing the preconditioners for each diagonal block.
void setup()
Setup the preconditioner.
double Scaling
The scaling. default 1.0.
unsigned Method
the preconditioning method. 0 - block diagonal 1 - upper triangular 2 - lower triangular
void clean_up_memory()
Broken assignment operator.
DenseMatrix< MatrixVectorProduct * > Off_diagonal_matrix_vector_products
Matrix of matrix vector product operators for the off diagonals.
///////////////////////////////////////////////////////////////////////////// ///////////////////////...
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the preconditioner.
SubsidiaryPreconditionerFctPt Subsidiary_preconditioner_function_pt
the SubisidaryPreconditionerFctPt
void clean_up_memory()
clears the memory
Preconditioner * Preconditioner_pt
the preconditioner pt
void setup()
Broken assignment operator.
SubsidiaryPreconditionerFctPt Lagrange_multiplier_subsidiary_preconditioner_function_pt
The Lagrange multiplier subsidiary preconditioner function pointer.
void lagrange_multiplier_preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the lagrange multiplier subsidiary preconditioner.
bool Use_inf_norm_of_s_scaling
boolean indicating whether the inf-norm of S should be used as scaling. Default = true;
double Scaling
The scaling. Defaults to infinity norm of S.
void setup()
Broken assignment operator.
Vector< Preconditioner * > Lagrange_multiplier_preconditioner_pt
lagrange multiplier preconditioner pt
void elastic_preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the elastic subsidiary preconditioner.
Mesh * Lagrange_multiplier_mesh_pt
Pointer to the mesh containing the Lagrange multiplier elements.
SubsidiaryPreconditionerFctPt Elastic_subsidiary_preconditioner_function_pt
The solid subsidiary preconditioner function pointer.
Mesh * Elastic_mesh_pt
Pointer to the mesh containing the solid elements.
Elastic_preconditioner_type E_preconditioner_type
An unsigned indicating which method should be used for preconditioning the solid component.
@ Block_diagonal_preconditioner
@ Exact_block_preconditioner
@ Block_lower_triangular_preconditioner
@ Block_upper_triangular_preconditioner
void clean_up_memory()
Clears the memory.
Preconditioner * Elastic_preconditioner_pt
storage for the preconditioner for the solid system
unsigned Dim
the dimension of the problem
An interface to allow SuperLU to be used as an (exact) Preconditioner.
//////////////////////////////////////////////////////////////////////
An interface to the Trilinos AztecOO classes allowing it to be used as an Oomph-lib LinearSolver....
An interface to the Trilinos ML class - provides a function to construct a serial ML object,...
double inf_norm(const DenseMatrix< CRDoubleMatrix * > &matrix_pt)
Compute infinity (maximum) norm of sub blocks as if it was one matrix.
Preconditioner * get_lagrange_multiplier_preconditioner()
CG with diagonal preconditioner for the lagrange multiplier subsidiary linear systems.
Preconditioner * get_elastic_preconditioner()
AMG w/ GS smoothing for the augmented elastic subsidiary linear systems – calls Hypre version to stay...
Preconditioner * get_elastic_preconditioner_trilinos_ml()
TrilinosML smoothing for the augmented elastic subsidiary linear systems.
Preconditioner * get_elastic_preconditioner_hypre()
AMG w/ GS smoothing for the augmented elastic subsidiary linear systems.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...