26 #ifndef OOMPH_FSI_PRECONDITIONERS_HEADER
27 #define OOMPH_FSI_PRECONDITIONERS_HEADER
30 #include "../navier_stokes/navier_stokes_preconditioners.h"
166 const bool& allow_multiple_element_type_in_navier_stokes_mesh =
false)
173 allow_multiple_element_type_in_navier_stokes_mesh;
181 const bool& allow_multiple_element_type_in_wall_mesh =
false)
188 allow_multiple_element_type_in_wall_mesh;
275 std::ostringstream error_message;
276 error_message <<
"Pointer to fluid mesh hasn't been set!\n";
278 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
282 std::ostringstream error_message;
283 error_message <<
"Pointer to solid mesh hasn't been set!\n";
285 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
301 for (
unsigned i = n_fluid_dof;
i < n_dof;
i++)
303 dof_to_block_map[
i] = 1;
313 for (
unsigned i = 0;
i < n_fluid_dof;
i++)
315 ns_dof_lookup[
i] =
i;
321 this, ns_dof_lookup);
339 block_matrix_1_1.
clear();
410 temp_solid_vec.
clear();
415 another_temp_vec -= temp_fluid_vec;
452 temp_solid_vec -= aux_vec;
483 template<
typename MATRIX>
533 const bool& allow_multiple_element_type_in_navier_stokes_mesh =
false)
540 allow_multiple_element_type_in_navier_stokes_mesh;
547 const bool& allow_multiple_element_type_in_wall_mesh =
false)
554 allow_multiple_element_type_in_wall_mesh;
631 template<
typename MATRIX>
636 unsigned n_dof = this->nblock_types();
639 for (
unsigned i = 0;
i < n_dof;
i++)
641 for (
unsigned j = 0; j < n_dof; j++)
643 required_blocks(
i, j) =
false;
648 required_blocks(0, 0) =
true;
649 required_blocks(1, 0) =
true;
650 required_blocks(0, 1) =
true;
653 required_blocks(2, 2) =
true;
656 if (Retain_solid_onto_fluid_terms)
658 required_blocks(0, 2) =
true;
659 required_blocks(1, 2) =
true;
661 if (Retain_fluid_onto_solid_terms)
663 required_blocks(2, 0) =
true;
664 required_blocks(2, 1) =
true;
665 if (Retain_solid_onto_fluid_terms)
667 std::ostringstream error_message;
668 error_message <<
"Can't retain all off-diagonal blocks!\n";
670 OOMPH_CURRENT_FUNCTION,
671 OOMPH_EXCEPTION_LOCATION);
682 template<
typename MATRIX>
686 if (Preconditioner_pt != 0)
688 delete Preconditioner_pt;
689 Preconditioner_pt = 0;
692 if (Navier_stokes_mesh_pt == 0)
694 std::ostringstream error_message;
695 error_message <<
"Pointer to fluid mesh hasn't been set!\n";
697 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
699 if (Wall_mesh_pt == 0)
701 std::ostringstream error_message;
702 error_message <<
"Pointer to solid mesh hasn't been set!\n";
704 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
710 Navier_stokes_mesh_pt,
711 Allow_multiple_element_type_in_navier_stokes_mesh);
712 this->set_mesh(1, Wall_mesh_pt, Allow_multiple_element_type_in_wall_mesh);
715 unsigned n_fluid_dof = this->ndof_types_in_mesh(0);
716 unsigned n_dof = n_fluid_dof + this->ndof_types_in_mesh(1);
720 dof_to_block_map[n_fluid_dof - 1] = 1;
721 for (
unsigned i = n_fluid_dof;
i < n_dof;
i++)
723 dof_to_block_map[
i] = 2;
727 this->block_setup(dof_to_block_map);
730 n_dof = this->nblock_types();
736 identify_required_blocks(required_blocks);
740 for (
unsigned dof_i = 0; dof_i < n_dof; dof_i++)
742 for (
unsigned dof_j = 0; dof_j < n_dof; dof_j++)
744 selected_blocks[dof_i][dof_j].select_block(dof_i, dof_j,
false, 0);
746 if (required_blocks(dof_i, dof_j))
748 selected_blocks[dof_i][dof_j].want_block();
753 CRDoubleMatrix P_matrix = this->get_concatenated_block(selected_blocks);
757 Preconditioner_pt->
setup(&P_matrix);
764 template<
typename MATRIX>
772 this->get_block_ordered_preconditioner_vector(r, temp_vec);
775 Preconditioner_pt->preconditioner_solve(temp_vec, temp_vec);
778 this->return_block_ordered_preconditioner_vector(temp_vec, z);
Block Preconditioner base class. The block structure of the overall problem is determined from the Me...
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...
const Mesh * mesh_pt(const unsigned &i) const
Access to i-th mesh (of the various meshes that contain block preconditionable elements of the same n...
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 ...
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 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...
CRDoubleMatrix * matrix_pt() const
Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*,...
void turn_into_subsidiary_block_preconditioner(BlockPreconditioner< MATRIX > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse)
Function to turn this preconditioner into a subsidiary preconditioner that operates within a bigger "...
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...
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...
A class for compressed row matrices. This is a distributable object.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
A vector in the mathematical sense, initially developed for linear algebra type applications....
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
void clear()
wipes the DoubleVector
//////////////////////////////////////////////////////////////////////////// ////////////////////////...
void set_solid_preconditioner_pt(Preconditioner *solid_preconditioner_pt)
Broken assignment operator.
void use_block_triangular_version_with_solid_on_fluid()
Switch to block-triangular preconditioner in which action of solid dofs onto fluid equations is retai...
Mesh * Navier_stokes_mesh_pt
Pointer to the navier stokes mesh.
void enable_doc_time()
Enable documentation of time.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to r.
bool Doc_time
Set Doc_time to true for outputting results of timings.
bool Allow_multiple_element_type_in_navier_stokes_mesh
Flag to indicate if there are multiple element types in the Navier-Stokes mesh.
MatrixVectorProduct * Matrix_vector_product_0_1_pt
Pointer to fluid/solid interaction matrix.
FSIPreconditioner(const FSIPreconditioner &)=delete
Broken copy constructor.
void set_navier_stokes_mesh(Mesh *mesh_pt, const bool &allow_multiple_element_type_in_navier_stokes_mesh=false)
Setter function for the mesh containing the block-preconditionable Navier-Stokes elements....
void set_wall_mesh(Mesh *mesh_pt, const bool &allow_multiple_element_type_in_wall_mesh=false)
Setter function for the mesh containing the block-preconditionable FSI solid elements....
~FSIPreconditioner()
Destructor: Clean up.
bool Allow_multiple_element_type_in_wall_mesh
MatrixVectorProduct * Matrix_vector_product_1_0_pt
Pointer to solid/fluid solid interaction matrix.
NavierStokesSchurComplementPreconditioner * navier_stokes_preconditioner_pt() const
Access function to the Navier Stokes preconditioner (inexact solver)
void use_block_diagonal_version()
Switch to block-diagonal preconditioner.
void disable_doc_time()
Disable documentation of time.
Preconditioner * Solid_preconditioner_pt
Pointer to the solid preconditioner (inexact solver)
Preconditioner * solid_preconditioner_pt() const
Read-only access to solid preconditoner (use set_... to set it)
bool Retain_solid_onto_fluid_terms
Boolean flag used to indicate that the solid onto fluid interaction terms are to be retained.
void use_block_triangular_version_with_fluid_on_solid()
Switch to block-triangular preconditioner in which action of fluid dofs onto solid equations is retai...
bool Preconditioner_has_been_setup
Boolean indicating the preconditioner has been set up.
bool Retain_fluid_onto_solid_terms
Boolean flag used to indicate that the fluid onto solid interaction terms are to be retained.
void setup()
Setup the preconditioner.
NavierStokesSchurComplementPreconditioner * Navier_stokes_preconditioner_pt
Pointer the Navier Stokes preconditioner (inexact solver)
Mesh * Wall_mesh_pt
pointer to the solid mesh
FSIPreconditioner(Problem *problem_pt)
Constructor: By default use block triangular form with retained fluid on solid terms....
Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product m...
void multiply(const DoubleVector &x, DoubleVector &y) const
Apply the operator to the vector x and return the result in the vector y.
///////////////////////////////////////////////////////////////////////// ///////////////////////////...
void setup()
Setup the preconditioner.
void set_navier_stokes_mesh(Mesh *mesh_pt, const bool &allow_multiple_element_type_in_navier_stokes_mesh=false)
Specify the mesh containing the block-preconditionable Navier-Stokes elements. The optional argument ...
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to Vector r.
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...
double setup_time() const
Returns the time to setup the preconditioner.
virtual void preconditioner_solve(const DoubleVector &r, DoubleVector &z)=0
Apply the preconditioner. Pure virtual generic interface function. This method should apply the preco...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
bool Retain_fluid_onto_solid_terms
Boolean flag used to indicate that the fluid onto solid interaction terms are to be retained.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to r.
void set_wall_mesh(Mesh *mesh_pt, const bool &allow_multiple_element_type_in_wall_mesh=false)
Setter function for the mesh containing the block-preconditionable FSI solid elements.
Mesh * Wall_mesh_pt
pointer to the solid mesh
SimpleFSIPreconditioner()
Constructor.
bool Retain_solid_onto_fluid_terms
Boolean flag used to indicate that the solid onto fluid interaction terms are to be retained.
bool Allow_multiple_element_type_in_wall_mesh
Flag for multiple element types in the Wall mesh.
~SimpleFSIPreconditioner()
Destructor: Clean up.
void use_block_triangular_version_with_solid_on_fluid()
Switch to block-triangular preconditioner in which action of solid dofs onto fluid equations is retai...
SimpleFSIPreconditioner(const SimpleFSIPreconditioner &)=delete
Broken copy constructor.
Mesh * Navier_stokes_mesh_pt
Pointer to the navier stokes mesh.
bool Allow_multiple_element_type_in_navier_stokes_mesh
Flag for multiple element types in the Navier-Stokes mesh.
void use_block_diagonal_version()
Switch to block-diagonal preconditioner.
Preconditioner * Preconditioner_pt
Preconditioner (inexact solver)
void setup()
Setup the preconditioner.
void set_navier_stokes_mesh(Mesh *mesh_pt, const bool &allow_multiple_element_type_in_navier_stokes_mesh=false)
Broken assignment operator.
virtual void identify_required_blocks(DenseMatrix< bool > &required_blocks)
Identify the required blocks: Here we only need the momentum, gradient and divergence blocks of the 2...
void use_block_triangular_version_with_fluid_on_solid()
Switch to block-triangular preconditioner in which action of fluid dofs onto solid equations is retai...
An interface to allow SuperLU to be used as an (exact) Preconditioner.
void setup()
Function to set up a preconditioner for the linear system defined by matrix_pt. This function must be...
VectorMatrix is a generalised, STL-map-based, matrix based on a Vector of Vectors.
double timer()
returns the time in seconds after some point in past
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...