65 std::ostringstream error_message;
66 error_message <<
"The fluid and pseudo elastic mesh must be set.";
68 OOMPH_CURRENT_FUNCTION,
69 OOMPH_EXCEPTION_LOCATION);
74 std::ostringstream error_message;
75 error_message <<
"The solid mesh must be set.";
77 OOMPH_CURRENT_FUNCTION,
78 OOMPH_EXCEPTION_LOCATION);
82 std::ostringstream error_message;
83 error_message <<
"The Lagrange multiplier mesh must be set.";
85 OOMPH_CURRENT_FUNCTION,
86 OOMPH_EXCEPTION_LOCATION);
96 unsigned nfluid_dof =
Dim + 1;
108 unsigned ntotal_dof = nfluid_dof + npseudo_elastic_dof + nsolid_dof
117 for (
unsigned i = 0;
i < npseudo_elastic_dof;
i++)
119 dof_to_block_map[c] = 2;
122 for (
unsigned i = 0;
i < nsolid_dof;
i++)
124 dof_to_block_map[c] = 1;
127 for (
unsigned i = 0;
i < nlagr_mult_dof;
i++)
129 dof_to_block_map[c] = 3;
138 std::ostringstream error_message;
139 error_message <<
"FSIPreconditioner only works with" 140 <<
" CRDoubleMatrix matrices" << std::endl;
142 OOMPH_CURRENT_FUNCTION,
143 OOMPH_EXCEPTION_LOCATION);
160 for (
unsigned i = 0;
i < nfluid_dof;
i++)
177 delete ns_matrix_pt; ns_matrix_pt = 0;
186 solid_block_preconditioner_pt =
190 if (solid_block_preconditioner_pt != 0)
192 unsigned offset = nfluid_dof+npseudo_elastic_dof;
194 for (
unsigned i = 0;
i < nsolid_dof;
i++)
196 solid_prec_dof_list[
i]=offset+
i;
198 solid_block_preconditioner_pt
200 solid_prec_dof_list);
201 solid_block_preconditioner_pt->
setup(cr_matrix_pt);
205 std::ostringstream error_message;
206 error_message <<
"If the (real) solid preconditioner is a " 207 <<
"BlockPreconditioner then is must be a " 208 <<
"GeneralPurposeBlockPreconditioner";
210 OOMPH_CURRENT_FUNCTION,
211 OOMPH_EXCEPTION_LOCATION);
221 delete s_matrix_pt; s_matrix_pt = 0;
225 unsigned ndof_for_pseudo_elastic_prec =
Dim*3;
226 Vector<unsigned> pseudo_elastic_prec_dof_list(ndof_for_pseudo_elastic_prec,0);
227 for (
unsigned i = 0;
i <
Dim*2;
i++)
229 pseudo_elastic_prec_dof_list[
i] = nfluid_dof+
i;
231 for (
unsigned i = 0;
i <
Dim;
i++)
233 pseudo_elastic_prec_dof_list[
i+Dim*2] = nfluid_dof
234 + npseudo_elastic_dof + nsolid_dof +
i;
238 pseudo_elastic_prec_dof_list);
255 delete fp_matrix_pt; fp_matrix_pt = 0;
262 delete sf_matrix_pt; sf_matrix_pt = 0;
270 delete sp_matrix_pt; sp_matrix_pt = 0;
278 delete ls_matrix_pt; ls_matrix_pt = 0;
365 lagrange_multiplier_preconditioner_solve(z_copy,z);
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the preconditioner.
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...
MatrixVectorProduct * Solid_fluid_matvec_pt
solid onto fluid matrix vector operatio
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 clear()
wipes the DoubleVector
void clean_up_memory()
Broken assignment operator.
void clean_up_memory()
Helper function to delete preconditioner data.
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.
Preconditioner * Navier_stokes_preconditioner_pt
pointer to the navier stokes precondtioner
NavierStokesSchurComplementPreconditioner * Navier_stokes_schur_complement_preconditioner_pt
Navier Stokes Schur complement preconditioner.
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
void elastic_preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the elastic subsidiary preconditioner.
void setup()
Setup the precoonditioner.
CRDoubleMatrix * matrix_pt() const
Access function to matrix_pt. If this is the master then cast the matrix pointer to 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...
Mesh * Lagrange_multiplier_mesh_pt
Mesh containing the lagrange multiplier elements.
virtual void block_setup()
Determine the size of the matrix blocks and setup the lookup schemes relating the global degrees of f...
unsigned Dim
the dimension of the fluid
MatrixVectorProduct * Fluid_pseudo_elastic_matvec_pt
fluid onto pseudosolid matrix vector operator
MatrixVectorProduct * Lagrange_solid_matvec_pt
bool Solid_preconditioner_is_block_preconditioner
boolean flag to indicate whether the Solid preconditioner is a block preconditioner ...
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...
Mesh * Solid_mesh_pt
Mesh containing the solid elements.
void setup(DoubleMatrixBase *matrix_pt)
Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditio...
MatrixVectorProduct * Solid_pseudo_elastic_matvec_pt
solid onto pseudo solid matrix vector operatio
Preconditioner * Solid_preconditioner_pt
pointer to the solid preconditioner
bool Use_navier_stokes_schur_complement_preconditioner
If true the Navier Stokes Schur complement preconditioner is used. Otherwise SuperLUPreconditioner is...
PseudoElasticPreconditioner * Pseudo_elastic_preconditioner_pt
pointer to the pseudo solid preconditioner
Mesh * Fluid_and_pseudo_elastic_mesh_pt
Mesh containing the combined fluid and pseudo solid element.
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 "...
virtual void setup()=0
Setup the preconditioner. Pure virtual generic interface function.
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.
void clean_up_memory()
clear the memory
virtual void clean_up_memory()
Clean up memory (empty). Generic interface function.
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 ...
A class for compressed row matrices. This is a distributable object.
void clean_up_memory()
Clears the memory.