30 #ifndef OOMPH_FSI_PRECONDITIONERS_HEADER 31 #define OOMPH_FSI_PRECONDITIONERS_HEADER 35 #include "../navier_stokes/navier_stokes_preconditioners.h" 179 const bool& allow_multiple_element_type_in_navier_stokes_mesh =
false)
186 = allow_multiple_element_type_in_navier_stokes_mesh;
193 Mesh* mesh_pt,
const bool& allow_multiple_element_type_in_wall_mesh =
false)
200 = allow_multiple_element_type_in_wall_mesh;
286 std::ostringstream error_message;
287 error_message <<
"Pointer to fluid mesh hasn't been set!\n";
289 OOMPH_CURRENT_FUNCTION,
290 OOMPH_EXCEPTION_LOCATION);
294 std::ostringstream error_message;
295 error_message <<
"Pointer to solid mesh hasn't been set!\n";
297 OOMPH_CURRENT_FUNCTION,
298 OOMPH_EXCEPTION_LOCATION);
313 for (
unsigned i = n_fluid_dof;
i < n_dof;
i++)
315 dof_to_block_map[
i] = 1;
325 for (
unsigned i = 0;
i < n_fluid_dof;
i++)
327 ns_dof_lookup[
i] =
i;
351 block_matrix_1_1.
clear();
359 &block_matrix_0_1,1);
367 &block_matrix_1_0,0);
373 oomph_info <<
"Solid sub-preconditioner setup time [sec]: " 374 << setup_time <<
"\n";
422 temp_solid_vec.
clear();
427 another_temp_vec -= temp_fluid_vec;
465 temp_solid_vec-=aux_vec;
498 template<
typename MATRIX>
517 Preconditioner_pt = 0;
531 if (Preconditioner_pt != 0)
533 delete Preconditioner_pt;
534 Preconditioner_pt = 0;
556 const bool& allow_multiple_element_type_in_navier_stokes_mesh =
false)
563 = allow_multiple_element_type_in_navier_stokes_mesh;
570 const bool& allow_multiple_element_type_in_wall_mesh =
false)
577 = allow_multiple_element_type_in_wall_mesh;
657 template<
typename MATRIX>
666 for (
unsigned i=0;
i<n_dof;
i++)
668 for (
unsigned j=0;j<n_dof;j++)
670 required_blocks(
i,j)=
false;
675 required_blocks(0,0) =
true;
676 required_blocks(1,0) =
true;
677 required_blocks(0,1) =
true;
680 required_blocks(2,2) =
true;
685 required_blocks(0,2)=
true;
686 required_blocks(1,2)=
true;
690 required_blocks(2,0)=
true;
691 required_blocks(2,1)=
true;
694 std::ostringstream error_message;
695 error_message <<
"Can't retain all off-diagonal blocks!\n";
697 OOMPH_CURRENT_FUNCTION,
698 OOMPH_EXCEPTION_LOCATION);
710 template<
typename MATRIX>
716 if (Preconditioner_pt != 0)
718 delete Preconditioner_pt;
719 Preconditioner_pt = 0;
724 std::ostringstream error_message;
725 error_message <<
"Pointer to fluid mesh hasn't been set!\n";
727 OOMPH_CURRENT_FUNCTION,
728 OOMPH_EXCEPTION_LOCATION);
732 std::ostringstream error_message;
733 error_message <<
"Pointer to solid mesh hasn't been set!\n";
735 OOMPH_CURRENT_FUNCTION,
736 OOMPH_EXCEPTION_LOCATION);
751 dof_to_block_map[n_fluid_dof-1]=1;
752 for (
unsigned i = n_fluid_dof;
i < n_dof;
i++)
754 dof_to_block_map[
i] = 2;
767 identify_required_blocks(required_blocks);
771 for (
unsigned dof_i = 0; dof_i < n_dof; dof_i++)
773 for (
unsigned dof_j = 0; dof_j < n_dof; dof_j++)
775 selected_blocks[dof_i][dof_j].select_block(dof_i,dof_j,
false,0);
777 if(required_blocks(dof_i,dof_j))
779 selected_blocks[dof_i][dof_j].want_block();
788 Preconditioner_pt->
setup(&P_matrix);
795 template<
typename MATRIX>
806 Preconditioner_pt->preconditioner_solve(temp_vec,temp_vec);
Mesh * Navier_stokes_mesh_pt
Pointer to the navier stokes mesh.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to Vector r.
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...
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...
Mesh * Wall_mesh_pt
pointer to the solid mesh
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 Allow_multiple_element_type_in_navier_stokes_mesh
void clear()
wipes the DoubleVector
Preconditioner * Preconditioner_pt
Preconditioner (inexact solver)
NavierStokesSchurComplementPreconditioner * Navier_stokes_preconditioner_pt
Pointer the Navier Stokes preconditioner (inexact solver)
void disable_doc_time()
Disable documentation of time.
Preconditioner * solid_preconditioner_pt() const
Read-only access to solid preconditoner (use set_... to set it)
FSI preconditioner. This extracts upper/lower triangular blocks in the 3x3 overall block matrix struc...
bool Allow_multiple_element_type_in_navier_stokes_mesh
Flag for multiple element types in the Navier-Stokes mesh.
void enable_doc_time()
Enable documentation of time.
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. The optional argument indicates if there are more than one type of elements in the same mesh.
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...
NavierStokesSchurComplementPreconditioner * navier_stokes_preconditioner_pt() const
Access function to the Navier Stokes preconditioner (inexact solver)
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, block_pt is a pointer to the block matrix, block_col_indices is a vector indicating which block indices does the RHS vector we want to multiply the matrix by.
void use_block_diagonal_version()
Switch to block-diagonal preconditioner.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to r.
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...
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...
bool Allow_multiple_element_type_in_wall_mesh
Flag for multiple element types in the Wall mesh.
void setup()
Function to set up a preconditioner for the linear system defined by matrix_pt. This function must be...
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_solid_on_fluid()
Switch to block-triangular preconditioner in which action of solid dofs onto fluid equations is retai...
Preconditioner * Solid_preconditioner_pt
Pointer to the solid preconditioner (inexact solver)
Mesh * Wall_mesh_pt
pointer to the solid mesh
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
The least-squares commutator (LSC; formerly BFBT) Navier Stokes preconditioner. It uses blocks corres...
CRDoubleMatrix * matrix_pt() const
Access function to matrix_pt. If this is the master then cast the matrix pointer to MATRIX*...
MatrixVectorProduct * Matrix_vector_product_0_1_pt
Pointer to fluid/solid interaction matrix.
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...
FSI preconditioner. This extracts upper/lower triangular blocks in the 3x3 overall block matrix struc...
virtual void block_setup()
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of f...
bool Retain_solid_onto_fluid_terms
Boolean flag used to indicate that the solid onto fluid interaction terms are to be retained...
FSIPreconditioner(const FSIPreconditioner &)
Broken copy constructor.
SimpleFSIPreconditioner(const SimpleFSIPreconditioner &)
Broken copy constructor.
~SimpleFSIPreconditioner()
Destructor: Clean up.
void set_nmesh(const unsigned &n)
Specify the number of meshes required by this block preconditioner. Note: elements in different meshe...
void setup()
Setup the preconditioner.
bool Retain_fluid_onto_solid_terms
Boolean flag used to indicate that the fluid onto solid interaction terms are to be retained...
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...
double timer()
returns the time in seconds after some point in past
bool Allow_multiple_element_type_in_wall_mesh
void setup(DoubleMatrixBase *matrix_pt)
Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditio...
unsigned nblock_types() const
Return the number of block types.
FSIPreconditioner(Problem *problem_pt)
Constructor: By default use block triangular form with retained fluid on solid terms. A problem pointer is required for the underlying NavierStokesSchurComplementPreconditioner.
bool Retain_fluid_onto_solid_terms
Boolean flag used to indicate that the fluid onto solid interaction terms are to be retained...
An interface to allow SuperLU to be used as an (exact) Preconditioner.
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
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. The optional argument indicates if there are more than one type of elements in same mesh.
void setup()
Setup the preconditioner.
MatrixVectorProduct * Matrix_vector_product_1_0_pt
Pointer to solid/fluid solid interaction matrix.
void use_block_diagonal_version()
Switch to block-diagonal preconditioner.
bool Doc_time
Set Doc_time to true for outputting results of timings.
void turn_into_subsidiary_block_preconditioner(BlockPreconditioner< CRDoubleMatrix > *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 preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to r.
Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product m...
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...
~FSIPreconditioner()
Destructor: Clean up.
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
void multiply(const DoubleVector &x, DoubleVector &y) const
Apply the operator to the vector x and return the result in the vector y.
bool Preconditioner_has_been_setup
Boolean indicating the preconditioner has been set up.
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 ...
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...
void set_solid_preconditioner_pt(Preconditioner *solid_preconditioner_pt)
Broken assignment operator.
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 setup()
Setup the preconditioner.
A class for compressed row matrices. This is a distributable object.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
Mesh * Navier_stokes_mesh_pt
Pointer to the navier stokes mesh.
SimpleFSIPreconditioner()
Constructor.
CRDoubleMatrix get_concatenated_block(const VectorMatrix< BlockSelector > &selected_block)
Returns a concatenation of the block matrices specified by the argument selected_block. The VectorMatrix selected_block must be correctly sized as it is used to determine the number of sub block matrices to concatenate.
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...
double setup_time() const
Returns the time to setup the preconditioner.