44 namespace HypreSubsidiaryPreconditionerHelper
85 std::ostringstream error_message;
88 error_message <<
"NavierStokesSchurComplementPreconditioner only works "
89 <<
"with CRDoubleMatrix matrices" << std::endl;
116 oomph_info <<
"Number of dof types: " << n_dof_types << std::endl;
122 std::ostringstream error_message;
125 error_message <<
"Should only be 3 dof types! You have " <<
n_dof_types
126 <<
" dof types!" << std::endl;
137 throw OomphLibError(
"Can only be used as a subsidiary preconditioner!",
165 oomph_info <<
"Number of block types: " << n_block_type << std::endl;
222 j_pt->sparse_indexed_output_with_offset(
"j_" +
suffix +
".csv");
248 f_pt->sparse_indexed_output_with_offset(
"f_matrix" +
suffix +
".dat");
301#ifdef OOMPH_HAS_HYPRE
409 z.
build(
r.distribution_pt(), 0.0);
529 oomph_info <<
"Number of dof types: " << n_dof_types << std::endl;
535 std::ostringstream error_message;
538 error_message <<
"Should only be 3 dof types! You have " <<
n_dof_types
539 <<
" dof types!" << std::endl;
551 throw OomphLibError(
"Currently only used as a subsidiary preconditioner!",
577 oomph_info <<
"Number of block types: " << n_block_type << std::endl;
636 if (n_block_types != 1)
764 oomph_info <<
"GMRES block preconditioner converged immediately. "
765 <<
"Normalised residual norm: " <<
resid << std::endl;
781 oomph_info <<
"Time for all preconditioner applications [sec]: "
783 <<
"\nTotal time for solve with GMRES block preconditioner "
908 double*
vk_pt =
v[
k].values_pt();
914 for (
unsigned i = 0;
i <
n_dof;
i++)
1009 <<
"\nGMRES block preconditioner converged (1). Normalised "
1010 <<
"residual norm: " <<
resid
1011 <<
"\nNumber of iterations to convergence: " <<
iter <<
"\n"
1030 <<
"Time for all preconditioner applications [sec]: "
1032 <<
"\nTotal time for solve with GMRES block preconditioner "
1114 <<
"\nGMRES block preconditioner converged (2). Normalised "
1115 <<
"residual norm: " <<
resid
1116 <<
"\nNumber of iterations to convergence: " <<
iter <<
"\n"
1129 <<
"Time for all preconditioner applications [sec]: "
1131 <<
"\nTotal time for solve with GMRES block preconditioner "
1139 oomph_info <<
"\nGMRES block preconditioner did not converge to required "
1140 <<
"tolerance! \nReturning with normalised residual norm: "
1148 <<
"error on convergence failures.";
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 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...
unsigned nblock_types() const
Return the number of block types.
bool is_subsidiary_block_preconditioner() const
Return true if this preconditioner is a subsidiary preconditioner.
unsigned ndof_types() const
Return the total number of DOF types.
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 get_block_vectors(const Vector< unsigned > &block_vec_number, const DoubleVector &v, Vector< DoubleVector > &s) const
Takes the naturally ordered vector and rearranges it into a vector of sub vectors corresponding to th...
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,...
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...
A class for compressed row matrices. This is a distributable object.
void sparse_indexed_output_with_offset(std::string filename)
Indexed output function to print a matrix to a file as i,j,a(i,j) for a(i,j)!=0 only....
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
virtual void residual(const DoubleVector &x, const DoubleVector &b, DoubleVector &residual_)
Find the residual, i.e. r=b-Ax the residual.
A vector in the mathematical sense, initially developed for linear algebra type applications....
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
double norm() const
compute the 2 norm of this vector
double dot(const DoubleVector &vec) const
compute the dot product of this vector with the vector vec.
double * values_pt()
access function to the underlying values
void apply_plane_rotation(double &dx, double &dy, double &cs, double &sn)
Helper function: Apply plane rotation. This is done using the update:
SpaceTimeNavierStokesSubsidiaryPreconditioner * Navier_stokes_subsidiary_preconditioner_pt
Pointer to the preconditioner for the block matrix.
virtual void clean_up_memory()
Clean up the memory (empty for now...)
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to r.
bool Preconditioner_has_been_setup
Control flag is true if the preconditioner has been setup (used so we can wipe the data when the prec...
unsigned Iterations
Number of iterations taken.
bool Preconditioner_LHS
boolean indicating use of left hand preconditioning (if true) or right hand preconditioning (if false...
CRDoubleMatrix * Matrix_pt
Pointer to matrix.
void update(const unsigned &k, const Vector< Vector< double > > &H, const Vector< double > &s, const Vector< DoubleVector > &v, const DoubleVector &block_x_with_size_of_full_x, DoubleVector &x)
Helper function to update the result vector using the result, x=x_0+V_m*y.
void setup()
Setup the preconditioner.
void generate_plane_rotation(double &dx, double &dy, double &cs, double &sn)
Helper function: Generate a plane rotation. This is done by finding the values of (i....
An Preconditioner class using the suite of Hypre preconditioners to allow.
double Tolerance
Convergence tolerance.
bool Throw_error_after_max_iter
Should we throw an error instead of just returning when we hit the max iterations?
unsigned Max_iter
Maximum number of iterations.
double Solution_time
linear solver solution time
std::ofstream Output_file_stream
Output file stream for convergence history.
bool Doc_convergence_history
Flag indicating if the convergence history is to be documented.
bool built() const
if the communicator_pt is null then the distribution is not setup then false is returned,...
bool Doc_time
Boolean flag that indicates whether the time taken.
Matrix vector product helper class - primarily a wrapper to Trilinos's Epetra matrix vector product m...
void multiply_transpose(const DoubleVector &x, DoubleVector &y) const
Apply the transpose of the operator to the vector x and return the result in the vector y.
void multiply(const DoubleVector &x, DoubleVector &y) const
Apply the operator to the vector x and return the result in the vector y.
std::ostream *& stream_pt()
Access function for the stream pointer.
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...
std::ostream * Stream_pt
Pointer to the output stream – defaults to std::cout.
virtual void setup(DoubleMatrixBase *matrix_pt)
Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditio...
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 Silent_preconditioner_setup
Boolean to indicate whether or not the build should be done silently.
General purpose block triangular preconditioner. By default this is Upper triangular....
Preconditioner * P_preconditioner_pt
Pointer to the 'preconditioner' for the pressure matrix.
void setup()
Setup the preconditioner.
bool Preconditioner_has_been_setup
Control flag is true if the preconditioner has been setup (used so we can wipe the data when the prec...
MatrixVectorProduct * F_mat_vec_pt
MatrixVectorProduct operator for F.
MatrixVectorProduct * G_mat_vec_pt
MatrixVectorProduct operator for G.
Preconditioner * F_preconditioner_pt
Pointer to the 'preconditioner' for the F matrix.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply preconditioner to r.
bool Using_default_f_preconditioner
Flag indicating whether the default F preconditioner is used.
virtual void clean_up_memory()
Clean up the memory.
bool Using_default_p_preconditioner
Flag indicating whether the default P preconditioner is used.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
void concatenate(const DenseMatrix< CRDoubleMatrix * > &matrix_pt, CRDoubleMatrix &result_matrix)
Concatenate CRDoubleMatrix matrices. The in matrices are concatenated such that the block structure o...
Preconditioner * create_exact_preconditioner()
Factory function to create suitable exact preconditioner.
Preconditioner * set_hypre_preconditioner()
Assign the Hypre preconditioner pointer.
void set_defaults_for_2D_poisson_problem(HyprePreconditioner *hypre_preconditioner_pt)
Set default parameters for use as preconditioner in 2D Poisson-type problem.
double timer()
returns the time in seconds after some point in past
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Nullstream oomph_nullstream
Single (global) instantiation of the Nullstream.
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...