41 namespace Hypre_default_settings
112 namespace HypreHelpers
150 int err = HYPRE_GetError();
155 oomph_info <<
"Hypre error flag=" << err << std::endl;
156 char* error_message =
new char[128];
157 HYPRE_DescribeError(err, error_message);
158 message <<
"WARNING: " << std::endl
159 <<
"HYPRE error message: " << error_message << std::endl;
160 delete[] error_message;
180 HYPRE_IJVector& hypre_ij_vector,
181 HYPRE_ParVector& hypre_par_vector)
192 HYPRE_IJVectorCreate(
198 HYPRE_IJVectorCreate(MPI_COMM_WORLD, lower, upper, &hypre_ij_vector);
200 HYPRE_IJVectorSetObjectType(hypre_ij_vector, HYPRE_PARCSR);
201 HYPRE_IJVectorInitialize(hypre_ij_vector);
204 int* indices =
new int[nrow_local];
205 double* values =
new double[nrow_local];
206 const unsigned hypre_first_row = dist_pt->
first_row();
212 const double* o_pt = oomph_vec.
values_pt();
213 for (
unsigned i = 0;
i < nrow_local;
i++)
215 indices[
i] = hypre_first_row +
i;
216 values[
i] = o_pt[j +
i];
220 HYPRE_IJVectorSetValues(hypre_ij_vector, nrow_local, indices, values);
223 HYPRE_IJVectorAssemble(hypre_ij_vector);
224 HYPRE_IJVectorGetObject(hypre_ij_vector, (
void**)&hypre_par_vector);
241 HYPRE_IJVector& hypre_ij_vector,
242 HYPRE_ParVector& hypre_par_vector)
250 HYPRE_IJVectorCreate(
251 dist_pt->
communicator_pt()->mpi_comm(), lower, upper, &hypre_ij_vector);
253 HYPRE_IJVectorCreate(MPI_COMM_WORLD, lower, upper, &hypre_ij_vector);
255 HYPRE_IJVectorSetObjectType(hypre_ij_vector, HYPRE_PARCSR);
256 HYPRE_IJVectorInitialize(hypre_ij_vector);
259 HYPRE_IJVectorAssemble(hypre_ij_vector);
260 HYPRE_IJVectorGetObject(hypre_ij_vector, (
void**)&hypre_par_vector);
271 HYPRE_IJMatrix& hypre_ij_matrix,
272 HYPRE_ParCSRMatrix& hypre_par_matrix,
277 if (!oomph_matrix->
built())
279 std::ostringstream error_message;
280 error_message <<
"The matrix has not been built";
282 OOMPH_CURRENT_FUNCTION,
283 OOMPH_EXCEPTION_LOCATION);
286 if (oomph_matrix->
nrow() != oomph_matrix->
ncol())
288 std::ostringstream error_message;
289 error_message <<
"create_HYPRE_Matrix require a square matrix. "
290 <<
"Matrix is " << oomph_matrix->
nrow() <<
" by "
291 << oomph_matrix->
ncol() << std::endl;
293 OOMPH_CURRENT_FUNCTION,
294 OOMPH_EXCEPTION_LOCATION);
303 std::ostringstream error_stream;
305 <<
"Oomph-lib has been compiled with MPI support and "
306 <<
"you are using HYPRE.\n"
307 <<
"For this combination of flags, MPI must be initialised.\n"
308 <<
"Call MPI_Helpers::init() in the "
309 <<
"main() function of your driver code\n";
311 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
316 const unsigned nrow = int(oomph_matrix->
nrow());
324 const double* matrix_vals = oomph_matrix->
value();
327 const int* matrix_row_start = oomph_matrix->
row_start();
336 bool distributed =
true;
348 unsigned upper = lower + dist_pt->
nrow_local() - 1;
358 HYPRE_IJMatrixCreate(
359 MPI_COMM_WORLD, lower, upper, lower, upper, &hypre_ij_matrix);
361 HYPRE_IJMatrixSetObjectType(hypre_ij_matrix, HYPRE_PARCSR);
362 HYPRE_IJMatrixInitialize(hypre_ij_matrix);
366 const unsigned hypre_nrow_local = dist_pt->
nrow_local();
367 const unsigned hypre_first_row = dist_pt->
first_row();
368 int* ncols_per_row =
new int[hypre_nrow_local];
369 int* row_map =
new int[hypre_nrow_local];
370 for (
unsigned i = 0;
i < hypre_nrow_local;
i++)
375 j += hypre_first_row;
377 ncols_per_row[
i] = matrix_row_start[j + 1] - matrix_row_start[j];
378 row_map[
i] = hypre_first_row +
i;
385 local_start += matrix_row_start[hypre_first_row];
389 HYPRE_IJMatrixSetValues(hypre_ij_matrix,
393 matrix_cols + local_start,
394 matrix_vals + local_start);
397 HYPRE_IJMatrixAssemble(hypre_ij_matrix);
398 HYPRE_IJMatrixGetObject(hypre_ij_matrix, (
void**)&hypre_par_matrix);
401 delete[] ncols_per_row;
410 const bool& use_row_scaling,
411 const bool& use_ilut,
413 const double& drop_tol,
414 const int& print_level,
415 HYPRE_Solver& euclid_object)
422 const char* args[22];
428 args[n_args++] =
"-bj";
429 if (use_block_jacobi)
431 args[n_args++] =
"1";
435 args[n_args++] =
"0";
439 args[n_args++] =
"-rowScale";
442 args[n_args++] =
"1";
446 args[n_args++] =
"0";
450 args[n_args++] =
"-level";
451 char level_value[10];
452 sprintf(level_value,
"%d", level);
453 args[n_args++] = level_value;
469 if (print_level == 0)
471 args[n_args++] =
"-eu_stats";
472 args[n_args++] =
"0";
473 args[n_args++] =
"-eu_mem";
474 args[n_args++] =
"0";
476 if (print_level == 1)
478 args[n_args++] =
"-eu_stats";
479 args[n_args++] =
"1";
480 args[n_args++] =
"-eu_mem";
481 args[n_args++] =
"0";
483 if (print_level == 2)
485 args[n_args++] =
"-eu_stats";
486 args[n_args++] =
"1";
487 args[n_args++] =
"-eu_mem";
488 args[n_args++] =
"1";
495 HYPRE_EuclidSetParams(euclid_object, n_args,
const_cast<char**
>(args));
523 <<
"Warning: HYPRE based solvers may fail if 2*number of processors "
524 <<
"is greater than the number of unknowns!" << std::endl;
535 std::ostringstream message;
540 "HypreSolver::hypre_matrix_setup()",
541 OOMPH_EXCEPTION_LOCATION);
569 HYPRE_IJVector dummy_sol_ij;
570 HYPRE_ParVector dummy_sol_par;
571 HYPRE_IJVector dummy_rhs_ij;
572 HYPRE_ParVector dummy_rhs_par;
663 HYPRE_ParaSailsCreate(
670 HYPRE_ParaSailsSetParams(
679 std::ostringstream message;
684 "HypreSolver::hypre_setup()",
685 OOMPH_EXCEPTION_LOCATION);
704 HYPRE_BoomerAMGCreate(&
Solver);
729 HYPRE_BoomerAMGSetRelaxWeight(
Solver, relaxweight);
789 HYPRE_EuclidCreate(MPI_COMM_WORLD, &
Solver);
813 HYPRE_ParaSailsCreate(
816 HYPRE_ParaSailsCreate(MPI_COMM_WORLD, &
Solver);
835 HYPRE_ParCSRPCGCreate(
838 HYPRE_ParCSRPCGCreate(MPI_COMM_WORLD, &
Solver);
841 HYPRE_PCGSetLogging(
Solver, 0);
850 oomph_info <<
" with BoomerAMG preconditioner, ";
853 HYPRE_PCGSetPrecond(
Solver,
854 (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSolve,
855 (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSetup,
862 oomph_info <<
" with Euclid ILU preconditioner, ";
865 HYPRE_PCGSetPrecond(
Solver,
866 (HYPRE_PtrToSolverFcn)HYPRE_EuclidSolve,
867 (HYPRE_PtrToSolverFcn)HYPRE_EuclidSetup,
874 oomph_info <<
" with ParaSails approximate inverse preconditioner, ";
877 HYPRE_PCGSetPrecond(
Solver,
878 (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSolve,
879 (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSetup,
893 (HYPRE_Vector)dummy_rhs_par,
894 (HYPRE_Vector)dummy_sol_par);
909 HYPRE_ParCSRGMRESCreate(
912 HYPRE_ParCSRGMRESCreate(MPI_COMM_WORLD, &
Solver);
916 HYPRE_GMRESSetLogging(
Solver, 0);
925 oomph_info <<
" with BoomerAMG preconditioner, ";
928 HYPRE_GMRESSetPrecond(
Solver,
929 (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSolve,
930 (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSetup,
937 oomph_info <<
" with Euclid ILU preconditioner, ";
940 HYPRE_GMRESSetPrecond(
Solver,
941 (HYPRE_PtrToSolverFcn)HYPRE_EuclidSolve,
942 (HYPRE_PtrToSolverFcn)HYPRE_EuclidSetup,
949 oomph_info <<
" with ParaSails approximate inverse preconditioner, ";
952 HYPRE_GMRESSetPrecond(
Solver,
953 (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSolve,
954 (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSetup,
967 (HYPRE_Vector)dummy_rhs_par,
968 (HYPRE_Vector)dummy_sol_par);
981 HYPRE_ParCSRBiCGSTABCreate(
984 HYPRE_ParCSRBiCGSTABCreate(MPI_COMM_WORLD, &
Solver);
987 HYPRE_BiCGSTABSetLogging(
Solver, 0);
996 oomph_info <<
" with BoomerAMG preconditioner, ";
999 HYPRE_BiCGSTABSetPrecond(
Solver,
1000 (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSolve,
1001 (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSetup,
1008 oomph_info <<
" with Euclid ILU preconditioner, ";
1011 HYPRE_BiCGSTABSetPrecond(
Solver,
1012 (HYPRE_PtrToSolverFcn)HYPRE_EuclidSolve,
1013 (HYPRE_PtrToSolverFcn)HYPRE_EuclidSetup,
1020 oomph_info <<
" with ParaSails approximate inverse preconditioner, ";
1023 HYPRE_BiCGSTABSetPrecond(
Solver,
1024 (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSolve,
1025 (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSetup,
1036 HYPRE_BiCGSTABSetup(
Solver,
1038 (HYPRE_Vector)dummy_rhs_par,
1039 (HYPRE_Vector)dummy_sol_par);
1047 std::ostringstream error_message;
1048 error_message <<
"Solver has been set to an invalid value. "
1049 <<
"current value=" <<
Solver;
1051 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1055 double solver_setup_time = t_end - t_start;
1058 HYPRE_IJVectorDestroy(dummy_sol_ij);
1059 HYPRE_IJVectorDestroy(dummy_rhs_ij);
1064 std::ostringstream message;
1069 "HypreSolver::hypre_solver_setup()",
1070 OOMPH_EXCEPTION_LOCATION);
1077 oomph_info <<
"time for setup [s] : " << solver_setup_time << std::endl;
1096 HYPRE_IJVector rhs_ij;
1097 HYPRE_ParVector rhs_par;
1100 HYPRE_IJVector solution_ij;
1101 HYPRE_ParVector solution_par;
1113 std::ostringstream message;
1118 "HypreSolver::hypre_solve()",
1119 OOMPH_EXCEPTION_LOCATION);
1131 const double rhs_norm = rhs.
norm();
1132 bool do_solving =
false;
1138 #ifdef OOMPH_HAS_MPI
1145 unsigned this_processor_do_solving = 0;
1146 unsigned all_processors_do_solving = 0;
1149 this_processor_do_solving = 1;
1154 MPI_Allreduce(&this_processor_do_solving,
1155 &all_processors_do_solving,
1159 comm_pt->mpi_comm());
1160 if (all_processors_do_solving > 0)
1173 HYPRE_BoomerAMGGetNumIterations(
Solver, &iterations);
1174 HYPRE_BoomerAMGGetFinalRelativeResidualNorm(
Solver, &norm);
1180 (HYPRE_Vector)rhs_par,
1181 (HYPRE_Vector)solution_par);
1182 HYPRE_PCGGetNumIterations(
Solver, &iterations);
1183 HYPRE_PCGGetFinalRelativeResidualNorm(
Solver, &norm);
1189 (HYPRE_Vector)rhs_par,
1190 (HYPRE_Vector)solution_par);
1191 HYPRE_GMRESGetNumIterations(
Solver, &iterations);
1192 HYPRE_GMRESGetFinalRelativeResidualNorm(
Solver, &norm);
1196 HYPRE_BiCGSTABSolve(
Solver,
1198 (HYPRE_Vector)rhs_par,
1199 (HYPRE_Vector)solution_par);
1200 HYPRE_BiCGSTABGetNumIterations(
Solver, &iterations);
1201 HYPRE_BiCGSTABGetFinalRelativeResidualNorm(
Solver, &norm);
1215 std::ostringstream message;
1220 "HypreSolver::hypre_solve()",
1221 OOMPH_EXCEPTION_LOCATION);
1230 int* indices =
new int[nrow_local];
1231 for (
unsigned i = 0;
i < nrow_local;
i++)
1233 indices[
i] = first_row +
i;
1236 if (solution.
built())
1245 HYPRE_IJVectorGetValues(
1246 solution_ij, nrow_local, indices, solution.
values_pt());
1249 delete soln_dist_pt;
1254 std::ostringstream message;
1259 "HypreSolver::hypre_solve()",
1260 OOMPH_EXCEPTION_LOCATION);
1265 HYPRE_IJVectorDestroy(solution_ij);
1266 HYPRE_IJVectorDestroy(rhs_ij);
1269 double solve_time = 0;
1273 solve_time = t_end - t_start;
1279 oomph_info <<
"Time for HYPRE solve [s] : " << solve_time << std::endl;
1288 oomph_info <<
"Number of iterations : " << iterations
1291 oomph_info <<
"Final Relative Residual Norm : " << norm << std::endl;
1312 HYPRE_BoomerAMGDestroy(
Solver);
1316 HYPRE_ParCSRPCGDestroy(
Solver);
1320 HYPRE_ParCSRGMRESDestroy(
Solver);
1324 HYPRE_ParCSRBiCGSTABDestroy(
Solver);
1328 HYPRE_EuclidDestroy(
Solver);
1332 HYPRE_ParaSailsDestroy(
Solver);
1354 std::ostringstream message;
1359 "HypreSolver::clean_up_memory()",
1360 OOMPH_EXCEPTION_LOCATION);
1405 oomph_info <<
"Time to generate Jacobian and residual [s] : ";
1442 if (matrix_pt->
nrow() != matrix_pt->
ncol())
1444 std::ostringstream error_message;
1445 error_message <<
"HypreSolver require a square matrix. "
1446 <<
"Matrix is " << matrix_pt->
nrow() <<
" by "
1447 << matrix_pt->
ncol() << std::endl;
1449 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1477 std::ostringstream error_message;
1478 error_message <<
"The distribution of the rhs vector and the matrix "
1479 <<
" must be the same" << std::endl;
1481 OOMPH_CURRENT_FUNCTION,
1482 OOMPH_EXCEPTION_LOCATION);
1486 if (solution.
built())
1490 std::ostringstream error_message;
1491 error_message <<
"The distribution of the solution vector is setup "
1492 <<
"there it must be the same as the matrix."
1495 OOMPH_CURRENT_FUNCTION,
1496 OOMPH_EXCEPTION_LOCATION);
1506 std::ostringstream error_message;
1507 error_message <<
"HypreSolver only work with "
1508 <<
"CRDoubleMatrix matrices" << std::endl;
1510 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1538 std::ostringstream error_message;
1539 error_message <<
"resolve(...) requires that solver data has been "
1540 <<
"set up by a previous call to solve(...) after "
1541 <<
"a call to enable_resolve()" << std::endl;
1543 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1549 std::ostringstream error_message;
1550 error_message <<
"The distribution of the rhs vector and the matrix "
1551 <<
" must be the same" << std::endl;
1553 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1557 if (solution.
built())
1561 std::ostringstream error_message;
1562 error_message <<
"The distribution of the solution vector is setup "
1563 <<
"there it must be the same as the matrix."
1566 OOMPH_CURRENT_FUNCTION,
1567 OOMPH_EXCEPTION_LOCATION);
1614 std::map<std::string, double>
1632 std::map<std::string, unsigned>
1650 oomph_info <<
"\n\n=====================================================\n";
1651 oomph_info <<
"Cumulative HyprePreconditioner solve time "
1664 oomph_info <<
"Breakdown by context: " << std::endl;
1665 for (std::map<std::string, double>::iterator it =
1671 << (*it).first <<
" " << (*it).second <<
" for "
1687 <<
" per solve per dof )";
1692 oomph_info <<
"\n=====================================================\n";
1723 std::ostringstream error_message;
1724 error_message <<
"HyprePreconditioner require a square matrix. "
1728 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1751 std::ostringstream error_message;
1752 error_message <<
"HyprePreconditioner only work with "
1753 <<
"CRDoubleMatrix matrices" << std::endl;
1755 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1761 oomph_info <<
"Setup of HyprePreconditioner in context \" "
1764 <<
" " << cr_matrix_pt->
nnz() << std::endl;
1785 std::ostringstream error_message;
1786 error_message <<
"preconditioner_solve(...) requires that data has "
1787 <<
"been set up using the function setup(...)" << std::endl;
1789 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1795 std::ostringstream error_message;
1796 error_message <<
"The distribution of the rhs vector and the matrix "
1797 <<
" must be the same" << std::endl;
1799 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1808 std::ostringstream error_message;
1809 error_message <<
"The distribution of the solution vector is setup "
1810 <<
"there it must be the same as the matrix."
1813 OOMPH_CURRENT_FUNCTION,
1814 OOMPH_EXCEPTION_LOCATION);
//////////////////////////////////////////////////////////////////////////// ////////////////////////...
//////////////////////////////////////////////////////////////////////////// ////////////////////////...
A class for compressed row matrices. This is a distributable object.
int * column_index()
Access to C-style column index array.
int * row_start()
Access to C-style row_start array.
unsigned long ncol() const
Return the number of columns of the matrix.
unsigned long nnz() const
Return the number of nonzero entries (the local nnz)
bool built() const
access function to the Built flag - indicates whether the matrix has been build - i....
double * value()
Access to C-style value array.
unsigned long nrow() const
Return the number of rows of the matrix.
bool distributed() const
distribution is serial or distributed
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
unsigned nrow() const
access function to the number of global rows.
unsigned nrow_local() const
access function for the num of local rows on this processor.
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
Abstract base class for matrices of doubles – adds abstract interfaces for solving,...
virtual unsigned long ncol() const =0
Return the number of columns of the matrix.
virtual unsigned long nrow() const =0
Return the number of rows of the matrix.
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 * values_pt()
access function to the underlying values
void redistribute(const LinearAlgebraDistribution *const &dist_pt)
The contents of the vector are redistributed to match the new distribution. In a non-MPI rebuild this...
double norm() const
compute the 2 norm of this vector
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
bool Output_info
Flag is true to output info and results of timings.
bool Delete_input_data
Internal flag which is true when hypre_setup or hypre_solve can delete input matrix.
unsigned AMG_coarsening
AMG coarsening strategy. Coarsening types include: 0 = CLJP (parallel coarsening using independent se...
int Euclid_level
Euclid level parameter for ILU(k) factorization.
double AMGEuclidSmoother_drop_tol
bool Euclid_using_BJ
Flag to determine if Block Jacobi is used instead of PILU.
bool Euclid_rowScale
Flag to switch on Euclid row scaling.
double AMG_strength
Connection strength threshold parameter for BoomerAMG.
LinearAlgebraDistribution * Hypre_distribution_pt
the distribution for this helpers-
int ParaSails_nlevel
ParaSails nlevel parameter.
double ParaSails_filter
ParaSails filter parameter.
bool AMGEuclidSmoother_use_row_scaling
unsigned AMGEuclidSmoother_level
HYPRE_Solver Solver
The Hypre solver used in solve(...), resolve(...) or preconditioner_solve(...). [This is a C structur...
int ParaSails_symmetry
ParaSails symmetry flag, used to inform ParaSails of Symmetry of definitenss of problem and type of P...
HYPRE_ParCSRMatrix Matrix_par
The Hypre_ParCSRMatrix version of the matrix used in solve(...), resolve(...) or preconditioner_solve...
bool AMGEuclidSmoother_use_ilut
unsigned Internal_preconditioner
Preconditioner method flag used with Hypre's PCG, GMRES and BiCGStab in solve(...) or resolve(....
void hypre_solve(const DoubleVector &rhs, DoubleVector &solution)
Helper function performs a solve if any solver exists.
unsigned AMGEuclidSmoother_print_level
bool AMGEuclidSmoother_use_block_jacobi
unsigned AMG_complex_smoother
Complex smoothing methods used in BoomerAMG. Relaxation types are: 6 = Schwarz 7 = Pilut 8 = ParaSail...
double ParaSails_thresh
ParaSails thresh parameter.
double AMG_truncation
Interpolation truncation factor for BoomerAMG.
unsigned Krylov_print_level
Used to set the Hypre printing level for the Krylov subspace solvers.
unsigned AMG_smoother_iterations
The number of smoother iterations to apply.
unsigned existing_solver()
Function to return value of which solver (if any) is currently stored.
void hypre_clean_up_memory()
Function deletes all solver data.
bool Hypre_error_messages
Flag to determine if non-zero values of the Hypre error flag plus Hypre error messages are output to ...
double Tolerance
Tolerance used to terminate solver.
bool AMG_using_simple_smoothing
Flag to determine whether simple smoothers (determined by the AMG_simple_smoother flag) or complex sm...
unsigned Existing_solver
Used to keep track of which solver (if any) is currently stored.
unsigned Max_iter
Maximum number of iterations used in solver.
double AMG_damping
Damping factor for BoomerAMG smoothed Jacobi or hybrid SOR.
unsigned AMG_simple_smoother
Simple smoothing methods used in BoomerAMG. Relaxation types include: 0 = Jacobi 1 = Gauss-Seidel,...
unsigned AMG_print_level
Used to set the Hypre printing level for AMG 0: no printout 1: print setup information 2: print solve...
HYPRE_IJMatrix Matrix_ij
The Hypre_IJMatrix version of the matrix used in solve(...), resolve(...) or preconditioner_solve(....
unsigned Euclid_print_level
Flag to set the level of printing from Euclid when the Euclid destructor is called 0: no printing (de...
unsigned AMG_max_levels
Maximum number of levels used in AMG.
unsigned Hypre_method
Hypre method flag. Valid values are specified in enumeration.
void hypre_matrix_setup(CRDoubleMatrix *matrix_pt)
Function which sets values of First_global_row, Last_global_row and other partitioning data and creat...
double AMG_max_row_sum
Parameter to identify diagonally dominant parts of the matrix in AMG.
double Euclid_droptol
Euclid drop tolerance for ILU(k) and ILUT factorization.
unsigned Existing_preconditioner
Used to keep track of which preconditioner (if any) is currently stored.
bool Euclid_using_ILUT
Flag to determine if ILUT (if true) or ILU(k) is used in Euclid.
void hypre_solver_setup()
Sets up the data required for to use as an oomph-lib LinearSolver or Preconditioner....
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
unsigned & amg_simple_smoother()
Access function to AMG_simple_smoother flag.
static void reset_cumulative_solve_times()
Reset cumulative solve times.
double & amg_strength()
Access function to AMG_strength.
static std::map< std::string, unsigned > Context_based_cumulative_npreconditioner_solve
Static unsigned that accumulates the number of preconditioner solves of all instantiations of this cl...
std::string Context_string
String can be used to provide context for annotation.
double & amg_damping()
Access function to AMG_damping parameter.
void set_amg_iterations(const unsigned &amg_iterations)
Function to set the number of times to apply BoomerAMG.
void clean_up_memory()
Function deletes all solver data.
static double Cumulative_preconditioner_solve_time
Static double that accumulates the preconditioner solve time of all instantiations of this class....
void setup()
Function to set up a preconditioner for the linear system defined by matrix_pt. This function is requ...
unsigned & hypre_method()
Access function to Hypre_method flag – specified via enumeration.
static std::map< std::string, double > Context_based_cumulative_solve_time
Static double that accumulates the preconditioner solve time of all instantiations of this class,...
bool Delete_matrix
Hypre copies matrix data from oomph-lib's CRDoubleMatrix or DistributedCRDoubleMatrix into its own da...
static std::map< std::string, unsigned > Context_based_nrow
Static unsigned that stores nrow for the most recent instantiations of this class,...
void amg_using_simple_smoothing()
Function to select use of 'simple' AMG smoothers as controlled by the flag AMG_simple_smoother.
double My_cumulative_preconditioner_solve_time
Private double that accumulates the preconditioner solve time of thi instantiation of this class....
static void report_cumulative_solve_times()
Report cumulative solve times of all instantiations of this class.
unsigned & amg_coarsening()
Access function to AMG_coarsening flag.
static unsigned Cumulative_npreconditioner_solve
Static unsigned that accumulates the number of preconditioner solves of all instantiations of this cl...
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Function applies solver to vector r for preconditioning. This requires a call to setup(....
void solve(Problem *const &problem_pt, DoubleVector &solution)
Function which uses problem_pt's get_jacobian(...) function to generate a linear system which is then...
void clean_up_memory()
Function deletes all solver data.
bool Delete_matrix
Hypre copies matrix data from oomph-lib's CRDoubleMatrix or DistributedCRDoubleMatrix into its own da...
void resolve(const DoubleVector &rhs, DoubleVector &solution)
Function to resolve a linear system using the existing solver data, allowing a solve with a new right...
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed
unsigned first_row() const
access function for the first row on this processor. If not distributed then this is just zero.
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
void build(const OomphCommunicator *const comm_pt, const unsigned &first_row, const unsigned &nrow_local, const unsigned &nrow=0)
Sets the distribution. Takes first_row, nrow_local and nrow as arguments. If nrow is not provided or ...
unsigned nrow_local() const
access function for the num of local rows on this processor. If no MPI then Nrow is returned.
bool Doc_time
Boolean flag that indicates whether the time taken.
bool Enable_resolve
Boolean that indicates whether the matrix (or its factors, in the case of direct solver) should be st...
static bool mpi_has_been_initialised()
return true if MPI has been initialised
static OomphCommunicator * communicator_pt()
access to global communicator. This is the oomph-lib equivalent of MPI_COMM_WORLD
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
virtual DoubleMatrixBase * matrix_pt() const
Get function for matrix pointer.
////////////////////////////////////////////////////////////////// //////////////////////////////////...
virtual void get_jacobian(DoubleVector &residuals, DenseDoubleMatrix &jacobian)
Return the fully-assembled Jacobian and residuals for the problem Interface for the case when the Jac...
void create_HYPRE_Matrix(CRDoubleMatrix *oomph_matrix, HYPRE_IJMatrix &hypre_ij_matrix, HYPRE_ParCSRMatrix &hypre_par_matrix, LinearAlgebraDistribution *dist_pt)
Helper function to create a serial HYPRE_IJMatrix and HYPRE_ParCSRMatrix from a CRDoubleMatrix NOTE: ...
void create_HYPRE_Vector(const DoubleVector &oomph_vec, const LinearAlgebraDistribution *dist_pt, HYPRE_IJVector &hypre_ij_vector, HYPRE_ParVector &hypre_par_vector)
Helper function to create a HYPRE_IJVector and HYPRE_ParVector.
int check_HYPRE_error_flag(std::ostringstream &message)
Helper function to check the Hypre error flag, return the message associated with any error,...
unsigned AMG_coarsening
Default AMG coarsening strategy. Coarsening types include: 0 = CLJP (parallel coarsening using indepe...
double AMG_truncation
AMG interpolation truncation factor.
double AMG_strength
Default for AMG strength (0.25 recommended for 2D problems; larger (0.5-0.75, say) for 3D.
void euclid_settings_helper(const bool &use_block_jacobi, const bool &use_row_scaling, const bool &use_ilut, const int &level, const double &drop_tol, const int &print_level, HYPRE_Solver &euclid_object)
Helper function to set Euclid options using a command line like array.
void set_defaults_for_navier_stokes_momentum_block(HyprePreconditioner *hypre_preconditioner_pt)
Set default parameters for use as preconditioner in for momentum block in Navier-Stokes problem.
void set_defaults_for_3D_poisson_problem(HyprePreconditioner *hypre_preconditioner_pt)
Set default parameters for use as preconditioner in 3D Poisson-type problem.
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
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...