oomph::HypreInterface Class Reference

#include <hypre_solver.h>

+ Inheritance diagram for oomph::HypreInterface:

Public Types

enum  Hypre_method_types {
  CG , GMRES , BiCGStab , BoomerAMG ,
  Euclid , ParaSails , None
}
 

Public Member Functions

 HypreInterface ()
 Constructor. More...
 
 ~HypreInterface ()
 Destructor. More...
 
 HypreInterface (const HypreInterface &)=delete
 Broken copy constructor. More...
 
void operator= (const HypreInterface &)=delete
 Broken assignment operator. More...
 
void enable_hypre_error_messages ()
 Turn on the hypre error messages. More...
 
void disable_hypre_error_messages ()
 Turn off hypre error messages. More...
 
unsigned existing_solver ()
 Function to return value of which solver (if any) is currently stored. More...
 
unsigned existing_preconditioner ()
 Function return value of which preconditioner (if any) is stored. More...
 

Public Attributes

bool AMGEuclidSmoother_use_block_jacobi
 
bool AMGEuclidSmoother_use_row_scaling
 
bool AMGEuclidSmoother_use_ilut
 
unsigned AMGEuclidSmoother_level
 
double AMGEuclidSmoother_drop_tol
 
unsigned AMGEuclidSmoother_print_level
 

Protected Member Functions

void hypre_clean_up_memory ()
 Function deletes all solver data. More...
 
void hypre_matrix_setup (CRDoubleMatrix *matrix_pt)
 
void hypre_solver_setup ()
 
void hypre_solve (const DoubleVector &rhs, DoubleVector &solution)
 

Protected Attributes

bool Output_info
 Flag is true to output info and results of timings. More...
 
unsigned Max_iter
 Maximum number of iterations used in solver. More...
 
double Tolerance
 Tolerance used to terminate solver. More...
 
unsigned Hypre_method
 Hypre method flag. Valid values are specified in enumeration. More...
 
unsigned Internal_preconditioner
 
unsigned AMG_print_level
 
unsigned AMG_max_levels
 Maximum number of levels used in AMG. More...
 
double AMG_max_row_sum
 Parameter to identify diagonally dominant parts of the matrix in AMG. More...
 
bool AMG_using_simple_smoothing
 
unsigned AMG_simple_smoother
 
unsigned AMG_complex_smoother
 
unsigned AMG_smoother_iterations
 The number of smoother iterations to apply. More...
 
double AMG_damping
 Damping factor for BoomerAMG smoothed Jacobi or hybrid SOR. More...
 
double AMG_strength
 Connection strength threshold parameter for BoomerAMG. More...
 
double AMG_truncation
 Interpolation truncation factor for BoomerAMG. More...
 
unsigned AMG_coarsening
 
int ParaSails_symmetry
 
int ParaSails_nlevel
 ParaSails nlevel parameter. More...
 
double ParaSails_thresh
 ParaSails thresh parameter. More...
 
double ParaSails_filter
 ParaSails filter parameter. More...
 
double Euclid_droptol
 Euclid drop tolerance for ILU(k) and ILUT factorization. More...
 
bool Euclid_rowScale
 Flag to switch on Euclid row scaling. More...
 
bool Euclid_using_ILUT
 Flag to determine if ILUT (if true) or ILU(k) is used in Euclid. More...
 
bool Euclid_using_BJ
 Flag to determine if Block Jacobi is used instead of PILU. More...
 
int Euclid_level
 Euclid level parameter for ILU(k) factorization. More...
 
unsigned Euclid_print_level
 
unsigned Krylov_print_level
 
bool Hypre_error_messages
 
bool Delete_input_data
 

Private Attributes

bool Delete_matrix
 
HYPRE_IJMatrix Matrix_ij
 
HYPRE_ParCSRMatrix Matrix_par
 
HYPRE_Solver Solver
 
HYPRE_Solver Preconditioner
 
unsigned Existing_solver
 Used to keep track of which solver (if any) is currently stored. More...
 
unsigned Existing_preconditioner
 Used to keep track of which preconditioner (if any) is currently stored. More...
 
LinearAlgebraDistributionHypre_distribution_pt
 the distribution for this helpers- More...
 

Detailed Description

An interface class to the suite of Hypre solvers and preconditioners to allow use of:

BoomerAMG (AMG), CG, GMRES or BiCGStab, Euclid (ILU) or ParaSails (Approximate inverse)

Hypre's Krylov subspace solvers (CG, GMRES and BiCGStab) may be preconditioned using:

BoomerAMG, Euclid or ParaSails

Member Enumeration Documentation

◆ Hypre_method_types

Enumerated flag to define which Hypre methods are used CAREFUL: DON'T CHANGE THE ORDER OF THESE!

Enumerator
CG 
GMRES 
BiCGStab 
BoomerAMG 
Euclid 
ParaSails 
None 
256  {
257  CG,
258  GMRES,
259  BiCGStab,
260  BoomerAMG,
261  Euclid,
262  ParaSails,
263  None
264  };
@ BiCGStab
Definition: hypre_solver.h:259
@ ParaSails
Definition: hypre_solver.h:262
@ GMRES
Definition: hypre_solver.h:258
@ CG
Definition: hypre_solver.h:257
@ None
Definition: hypre_solver.h:263
@ BoomerAMG
Definition: hypre_solver.h:260
@ Euclid
Definition: hypre_solver.h:261

Constructor & Destructor Documentation

◆ HypreInterface() [1/2]

oomph::HypreInterface::HypreInterface ( )
inline

Constructor.

138  {
139 #ifdef PARANOID
140 #ifndef HYPRE_SEQUENTIAL
141  // For the MPI version of Hypre, check MPI_Helpers::setup has been called
143  {
144  std::ostringstream error_message;
145  error_message << "When using the MPI version of Hypre please first\n"
146  << "call function MPI_Helpers::setup()\n";
147  throw OomphLibError(error_message.str(),
150  }
151 #endif
152 #endif
153 
154  // setup the distribution
155  Hypre_distribution_pt = new LinearAlgebraDistribution();
156 
157  // These keep track of which solver and preconditioner
158  // (if any) currently exist
161 
162  // Do we want to output info and results of timings?
163  Output_info = true;
164 
165  // General control paramaters
166  Tolerance = 1e-10;
167  Max_iter = 100;
170 
171  // Default AMG control parameters -- these seem OK;
172  // see hypre documenation for details.
174  if (MPI_Helpers::communicator_pt()->nproc() > 1)
175  {
176  // Jacobi in parallel
178  }
179  else
180  {
181  // Gauss Seidel in serial
183  }
186  AMG_damping = 1.0;
190  AMG_max_levels = 100;
191  AMG_max_row_sum = 1.0;
192  AMG_print_level = 0;
193 
194  // Parameters for using Euclicd as an AMG smoother (defaults copied
195  // from the normal defaults listed in the manual).
200  AMGEuclidSmoother_drop_tol = 0; // No dropping
202 
203  // Print level for CG, GMRES and BiCGStab
204  Krylov_print_level = 0;
205 
206  // Set ParaSails default values
207  ParaSails_symmetry = 2;
208  ParaSails_nlevel = 1;
209  ParaSails_thresh = 0.1;
210  ParaSails_filter = 0.1;
211 
212  // Set Euclid default values
213  Euclid_droptol = 0.0;
214  Euclid_rowScale = false;
215  Euclid_using_ILUT = false;
216  Euclid_using_BJ = false;
217  Euclid_level = 1;
218  Euclid_print_level = 0;
219 
220  // Set to true to periodically check the hypre error flag
221  // and output any messages
222  Hypre_error_messages = false;
223  }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
bool Output_info
Flag is true to output info and results of timings.
Definition: hypre_solver.h:305
unsigned AMG_coarsening
Definition: hypre_solver.h:386
int Euclid_level
Euclid level parameter for ILU(k) factorization.
Definition: hypre_solver.h:418
double AMGEuclidSmoother_drop_tol
Definition: hypre_solver.h:283
bool Euclid_using_BJ
Flag to determine if Block Jacobi is used instead of PILU.
Definition: hypre_solver.h:415
bool Euclid_rowScale
Flag to switch on Euclid row scaling.
Definition: hypre_solver.h:409
double AMG_strength
Connection strength threshold parameter for BoomerAMG.
Definition: hypre_solver.h:369
LinearAlgebraDistribution * Hypre_distribution_pt
the distribution for this helpers-
Definition: hypre_solver.h:490
int ParaSails_nlevel
ParaSails nlevel parameter.
Definition: hypre_solver.h:397
double ParaSails_filter
ParaSails filter parameter.
Definition: hypre_solver.h:403
bool AMGEuclidSmoother_use_row_scaling
Definition: hypre_solver.h:280
unsigned AMGEuclidSmoother_level
Definition: hypre_solver.h:282
int ParaSails_symmetry
Definition: hypre_solver.h:394
bool AMGEuclidSmoother_use_ilut
Definition: hypre_solver.h:281
unsigned Internal_preconditioner
Definition: hypre_solver.h:320
unsigned AMGEuclidSmoother_print_level
Definition: hypre_solver.h:284
bool AMGEuclidSmoother_use_block_jacobi
Definition: hypre_solver.h:279
unsigned AMG_complex_smoother
Definition: hypre_solver.h:360
double ParaSails_thresh
ParaSails thresh parameter.
Definition: hypre_solver.h:400
double AMG_truncation
Interpolation truncation factor for BoomerAMG.
Definition: hypre_solver.h:372
unsigned Krylov_print_level
Definition: hypre_solver.h:429
unsigned AMG_smoother_iterations
The number of smoother iterations to apply.
Definition: hypre_solver.h:363
bool Hypre_error_messages
Definition: hypre_solver.h:441
double Tolerance
Tolerance used to terminate solver.
Definition: hypre_solver.h:311
bool AMG_using_simple_smoothing
Definition: hypre_solver.h:338
unsigned Existing_solver
Used to keep track of which solver (if any) is currently stored.
Definition: hypre_solver.h:484
unsigned Max_iter
Maximum number of iterations used in solver.
Definition: hypre_solver.h:308
double AMG_damping
Damping factor for BoomerAMG smoothed Jacobi or hybrid SOR.
Definition: hypre_solver.h:366
unsigned AMG_simple_smoother
Definition: hypre_solver.h:351
unsigned AMG_print_level
Definition: hypre_solver.h:327
unsigned Euclid_print_level
Definition: hypre_solver.h:425
unsigned AMG_max_levels
Maximum number of levels used in AMG.
Definition: hypre_solver.h:330
unsigned Hypre_method
Hypre method flag. Valid values are specified in enumeration.
Definition: hypre_solver.h:314
double AMG_max_row_sum
Parameter to identify diagonally dominant parts of the matrix in AMG.
Definition: hypre_solver.h:333
double Euclid_droptol
Euclid drop tolerance for ILU(k) and ILUT factorization.
Definition: hypre_solver.h:406
unsigned Existing_preconditioner
Used to keep track of which preconditioner (if any) is currently stored.
Definition: hypre_solver.h:487
bool Euclid_using_ILUT
Flag to determine if ILUT (if true) or ILU(k) is used in Euclid.
Definition: hypre_solver.h:412
static bool mpi_has_been_initialised()
return true if MPI has been initialised
Definition: oomph_utilities.h:851
static OomphCommunicator * communicator_pt()
access to the global oomph-lib communicator
Definition: oomph_utilities.cc:1046
unsigned AMG_coarsening
Definition: hypre_solver.cc:134
double AMG_truncation
AMG interpolation truncation factor.
Definition: hypre_solver.cc:140
double AMG_strength
Definition: hypre_solver.cc:118
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References oomph::HypreHelpers::AMG_coarsening, AMG_coarsening, AMG_complex_smoother, AMG_damping, AMG_max_levels, AMG_max_row_sum, AMG_print_level, AMG_simple_smoother, AMG_smoother_iterations, oomph::HypreHelpers::AMG_strength, AMG_strength, oomph::HypreHelpers::AMG_truncation, AMG_truncation, AMG_using_simple_smoothing, AMGEuclidSmoother_drop_tol, AMGEuclidSmoother_level, AMGEuclidSmoother_print_level, AMGEuclidSmoother_use_block_jacobi, AMGEuclidSmoother_use_ilut, AMGEuclidSmoother_use_row_scaling, oomph::MPI_Helpers::communicator_pt(), e(), Euclid_droptol, Euclid_level, Euclid_print_level, Euclid_rowScale, Euclid_using_BJ, Euclid_using_ILUT, Existing_preconditioner, Existing_solver, GMRES, Hypre_distribution_pt, Hypre_error_messages, Hypre_method, Internal_preconditioner, Krylov_print_level, Max_iter, oomph::MPI_Helpers::mpi_has_been_initialised(), None, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Output_info, ParaSails_filter, ParaSails_nlevel, ParaSails_symmetry, ParaSails_thresh, and Tolerance.

◆ ~HypreInterface()

oomph::HypreInterface::~HypreInterface ( )
inline

Destructor.

227  {
228  // call function to delete solver data
230 
231  // delete teh oomph-lib distribution
232  delete Hypre_distribution_pt;
233  }
void hypre_clean_up_memory()
Function deletes all solver data.
Definition: hypre_solver.cc:1301

References hypre_clean_up_memory(), and Hypre_distribution_pt.

◆ HypreInterface() [2/2]

oomph::HypreInterface::HypreInterface ( const HypreInterface )
delete

Broken copy constructor.

Member Function Documentation

◆ disable_hypre_error_messages()

void oomph::HypreInterface::disable_hypre_error_messages ( )
inline

Turn off hypre error messages.

249  {
250  Hypre_error_messages = false;
251  }

References Hypre_error_messages.

◆ enable_hypre_error_messages()

void oomph::HypreInterface::enable_hypre_error_messages ( )
inline

Turn on the hypre error messages.

243  {
244  Hypre_error_messages = true;
245  }

References Hypre_error_messages.

Referenced by main(), and TetmeshPoissonProblem< ELEMENT >::TetmeshPoissonProblem().

◆ existing_preconditioner()

unsigned oomph::HypreInterface::existing_preconditioner ( )
inline

Function return value of which preconditioner (if any) is stored.

274  {
276  }

References Existing_preconditioner.

◆ existing_solver()

unsigned oomph::HypreInterface::existing_solver ( )
inline

Function to return value of which solver (if any) is currently stored.

268  {
269  return Existing_solver;
270  }

References Existing_solver.

Referenced by oomph::HyprePreconditioner::preconditioner_solve(), and oomph::HypreSolver::resolve().

◆ hypre_clean_up_memory()

void oomph::HypreInterface::hypre_clean_up_memory ( )
protected

Function deletes all solver data.

hypre_clean_up_memory() deletes any existing Hypre solver and Hypre matrix

1302  {
1303  // is there an existing solver
1304  if (Existing_solver != None)
1305  {
1306  // delete matrix
1307  HYPRE_IJMatrixDestroy(Matrix_ij);
1308 
1309  // delete solver
1310  if (Existing_solver == BoomerAMG)
1311  {
1312  HYPRE_BoomerAMGDestroy(Solver);
1313  }
1314  else if (Existing_solver == CG)
1315  {
1316  HYPRE_ParCSRPCGDestroy(Solver);
1317  }
1318  else if (Existing_solver == GMRES)
1319  {
1320  HYPRE_ParCSRGMRESDestroy(Solver);
1321  }
1322  else if (Existing_solver == BiCGStab)
1323  {
1324  HYPRE_ParCSRBiCGSTABDestroy(Solver);
1325  }
1326  else if (Existing_solver == Euclid)
1327  {
1328  HYPRE_EuclidDestroy(Solver);
1329  }
1330  else if (Existing_solver == ParaSails)
1331  {
1332  HYPRE_ParaSailsDestroy(Solver);
1333  }
1335 
1336  // delete preconditioner
1338  {
1339  HYPRE_BoomerAMGDestroy(Preconditioner);
1340  }
1341  else if (Existing_preconditioner == Euclid)
1342  {
1343  HYPRE_EuclidDestroy(Preconditioner);
1344  }
1345  else if (Existing_preconditioner == ParaSails)
1346  {
1347  HYPRE_ParaSailsDestroy(Preconditioner);
1348  }
1350 
1351  // check error flag
1353  {
1354  std::ostringstream message;
1355  int err = HypreHelpers::check_HYPRE_error_flag(message);
1356  if (err)
1357  {
1358  OomphLibWarning(message.str(),
1359  "HypreSolver::clean_up_memory()",
1361  }
1362  }
1363  }
1364  }
Evaluates time-resolved continuum fields and writes the data into a stat file.
Definition: CG.h:55
HYPRE_Solver Solver
Definition: hypre_solver.h:477
HYPRE_Solver Preconditioner
Definition: hypre_solver.h:481
HYPRE_IJMatrix Matrix_ij
Definition: hypre_solver.h:469
int check_HYPRE_error_flag(std::ostringstream &message)
Definition: hypre_solver.cc:147

References BoomerAMG, oomph::HypreHelpers::check_HYPRE_error_flag(), Euclid, Existing_preconditioner, Existing_solver, Hypre_error_messages, Matrix_ij, None, OOMPH_EXCEPTION_LOCATION, ParaSails, and Solver.

Referenced by oomph::HypreSolver::clean_up_memory(), oomph::HyprePreconditioner::clean_up_memory(), and ~HypreInterface().

◆ hypre_matrix_setup()

void oomph::HypreInterface::hypre_matrix_setup ( CRDoubleMatrix matrix_pt)
protected

Function which sets values of First_global_row, Last_global_row and other partitioning data and creates the distributed Hypre matrix (stored in Matrix_ij/Matrix_par) from the CRDoubleMatrix.

//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Helper function which creates a Hypre matrix from a CRDoubleMatrix If OOMPH-LIB has been set up for MPI use, the Hypre matrix is distributed over the available processors.

514  {
515  // reset Hypre's global error flag
517 
518  // issue warning if the matrix is small compared to the number of processors
519  if (unsigned(2 * matrix_pt->distribution_pt()->communicator_pt()->nproc()) >
520  matrix_pt->nrow())
521  {
522  oomph_info
523  << "Warning: HYPRE based solvers may fail if 2*number of processors "
524  << "is greater than the number of unknowns!" << std::endl;
525  }
526 
527  // store the distribution
528  // generate the Hypre matrix
531 
532  // Output error messages if required
534  {
535  std::ostringstream message;
536  int err = HypreHelpers::check_HYPRE_error_flag(message);
537  if (err)
538  {
539  OomphLibWarning(message.str(),
540  "HypreSolver::hypre_matrix_setup()",
542  }
543  }
544 
545  // delete CRDoubleMatrix if required
546  if (Delete_input_data)
547  {
548  matrix_pt->clear();
549  }
550  }
bool Delete_input_data
Definition: hypre_solver.h:445
HYPRE_ParCSRMatrix Matrix_par
Definition: hypre_solver.h:473
int hypre__global_error
void create_HYPRE_Matrix(CRDoubleMatrix *oomph_matrix, HYPRE_IJMatrix &hypre_ij_matrix, HYPRE_ParCSRMatrix &hypre_par_matrix, LinearAlgebraDistribution *dist_pt)
Definition: hypre_solver.cc:270
OomphInfo oomph_info
Definition: oomph_definitions.cc:319

References oomph::HypreHelpers::check_HYPRE_error_flag(), oomph::CRDoubleMatrix::clear(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::HypreHelpers::create_HYPRE_Matrix(), Delete_input_data, oomph::DistributableLinearAlgebraObject::distribution_pt(), hypre__global_error, Hypre_distribution_pt, Hypre_error_messages, Matrix_ij, Matrix_par, oomph::OomphCommunicator::nproc(), oomph::CRDoubleMatrix::nrow(), OOMPH_EXCEPTION_LOCATION, and oomph::oomph_info.

Referenced by oomph::HyprePreconditioner::setup(), and oomph::HypreSolver::solve().

◆ hypre_solve()

void oomph::HypreInterface::hypre_solve ( const DoubleVector rhs,
DoubleVector solution 
)
protected

Helper function performs a solve if any solver exists.

Helper function performs a solve if solver data has been set up using hypre_solver_setup(...).

1088  {
1089  // Record time
1090  double t_start = TimingHelpers::timer();
1091 
1092  // Set up hypre vectors
1093  // --------------------
1094 
1095  // Hypre vector for rhs values
1096  HYPRE_IJVector rhs_ij;
1097  HYPRE_ParVector rhs_par;
1098 
1099  // Hypre vector for solution
1100  HYPRE_IJVector solution_ij;
1101  HYPRE_ParVector solution_par;
1102 
1103  // set up rhs_values and vec_indices
1105  rhs, Hypre_distribution_pt, rhs_ij, rhs_par);
1106 
1108  Hypre_distribution_pt, solution_ij, solution_par);
1109 
1110  // check error flag
1112  {
1113  std::ostringstream message;
1114  int err = HypreHelpers::check_HYPRE_error_flag(message);
1115  if (err)
1116  {
1117  OomphLibWarning(message.str(),
1118  "HypreSolver::hypre_solve()",
1120  }
1121  }
1122 
1123  // solve
1124  // -----
1125 
1126  // for solver stats
1127  int iterations = 0;
1128  double norm = 0;
1129 
1130  // Get the norm of rhs
1131  const double rhs_norm = rhs.norm();
1132  bool do_solving = false;
1133  if (rhs_norm > 0.0)
1134  {
1135  do_solving = true;
1136  }
1137 
1138 #ifdef OOMPH_HAS_MPI
1139  // We need to check whether any processor requires to solve, if that
1140  // is the case then do the solving
1142  {
1143  if (MPI_Helpers::communicator_pt()->nproc() > 1)
1144  {
1145  unsigned this_processor_do_solving = 0;
1146  unsigned all_processors_do_solving = 0;
1147  if (do_solving)
1148  {
1149  this_processor_do_solving = 1;
1150  }
1151  // Get the communicator
1152  OomphCommunicator* comm_pt = MPI_Helpers::communicator_pt();
1153  // Communicate with all procesoors
1154  MPI_Allreduce(&this_processor_do_solving,
1155  &all_processors_do_solving,
1156  1,
1157  MPI_UNSIGNED,
1158  MPI_SUM,
1159  comm_pt->mpi_comm());
1160  if (all_processors_do_solving > 0)
1161  {
1162  do_solving = true;
1163  }
1164  }
1165  }
1166 #endif
1167 
1168  if (do_solving)
1169  {
1170  if (Existing_solver == BoomerAMG)
1171  {
1172  HYPRE_BoomerAMGSolve(Solver, Matrix_par, rhs_par, solution_par);
1173  HYPRE_BoomerAMGGetNumIterations(Solver, &iterations);
1174  HYPRE_BoomerAMGGetFinalRelativeResidualNorm(Solver, &norm);
1175  }
1176  else if (Existing_solver == CG)
1177  {
1178  HYPRE_PCGSolve(Solver,
1179  (HYPRE_Matrix)Matrix_par,
1180  (HYPRE_Vector)rhs_par,
1181  (HYPRE_Vector)solution_par);
1182  HYPRE_PCGGetNumIterations(Solver, &iterations);
1183  HYPRE_PCGGetFinalRelativeResidualNorm(Solver, &norm);
1184  }
1185  else if (Existing_solver == GMRES)
1186  {
1187  HYPRE_GMRESSolve(Solver,
1188  (HYPRE_Matrix)Matrix_par,
1189  (HYPRE_Vector)rhs_par,
1190  (HYPRE_Vector)solution_par);
1191  HYPRE_GMRESGetNumIterations(Solver, &iterations);
1192  HYPRE_GMRESGetFinalRelativeResidualNorm(Solver, &norm);
1193  }
1194  else if (Existing_solver == BiCGStab)
1195  {
1196  HYPRE_BiCGSTABSolve(Solver,
1197  (HYPRE_Matrix)Matrix_par,
1198  (HYPRE_Vector)rhs_par,
1199  (HYPRE_Vector)solution_par);
1200  HYPRE_BiCGSTABGetNumIterations(Solver, &iterations);
1201  HYPRE_BiCGSTABGetFinalRelativeResidualNorm(Solver, &norm);
1202  }
1203  else if (Existing_solver == Euclid)
1204  {
1205  HYPRE_EuclidSolve(Solver, Matrix_par, rhs_par, solution_par);
1206  }
1207  else if (Existing_solver == ParaSails)
1208  {
1209  HYPRE_ParaSailsSolve(Solver, Matrix_par, rhs_par, solution_par);
1210  }
1211 
1212  // output any error message
1214  {
1215  std::ostringstream message;
1216  int err = HypreHelpers::check_HYPRE_error_flag(message);
1217  if (err)
1218  {
1219  OomphLibWarning(message.str(),
1220  "HypreSolver::hypre_solve()",
1222  }
1223  }
1224 
1225  } // if (do_solving)
1226 
1227  // Copy result to solution
1228  unsigned nrow_local = Hypre_distribution_pt->nrow_local();
1229  unsigned first_row = Hypre_distribution_pt->first_row();
1230  int* indices = new int[nrow_local];
1231  for (unsigned i = 0; i < nrow_local; i++)
1232  {
1233  indices[i] = first_row + i;
1234  }
1235  LinearAlgebraDistribution* soln_dist_pt;
1236  if (solution.built())
1237  {
1238  soln_dist_pt = new LinearAlgebraDistribution(solution.distribution_pt());
1239  }
1240  else
1241  {
1242  soln_dist_pt = new LinearAlgebraDistribution(rhs.distribution_pt());
1243  }
1244  solution.build(Hypre_distribution_pt, 0.0);
1245  HYPRE_IJVectorGetValues(
1246  solution_ij, nrow_local, indices, solution.values_pt());
1247  solution.redistribute(soln_dist_pt);
1248  delete[] indices;
1249  delete soln_dist_pt;
1250 
1251  // output any error message
1253  {
1254  std::ostringstream message;
1255  int err = HypreHelpers::check_HYPRE_error_flag(message);
1256  if (err)
1257  {
1258  OomphLibWarning(message.str(),
1259  "HypreSolver::hypre_solve()",
1261  }
1262  }
1263 
1264  // deallocation
1265  HYPRE_IJVectorDestroy(solution_ij);
1266  HYPRE_IJVectorDestroy(rhs_ij);
1267 
1268  // Record time
1269  double solve_time = 0;
1270  if (Output_info)
1271  {
1272  double t_end = TimingHelpers::timer();
1273  solve_time = t_end - t_start;
1274  }
1275 
1276  // output timings and info
1277  if (Output_info)
1278  {
1279  oomph_info << "Time for HYPRE solve [s] : " << solve_time << std::endl;
1280  }
1281 
1282  // for iterative solvers output iterations and final norm
1283  if ((Hypre_method >= CG) && (Hypre_method <= BoomerAMG))
1284  {
1285  if (iterations > 1)
1286  {
1287  if (Output_info)
1288  oomph_info << "Number of iterations : " << iterations
1289  << std::endl;
1290  if (Output_info)
1291  oomph_info << "Final Relative Residual Norm : " << norm << std::endl;
1292  }
1293  }
1294  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
unsigned first_row() const
Definition: linear_algebra_distribution.h:261
unsigned nrow_local() const
Definition: linear_algebra_distribution.h:193
void solution(const Vector< double > &x, Vector< double > &u)
Definition: two_d_biharmonic.cc:113
void create_HYPRE_Vector(const DoubleVector &oomph_vec, const LinearAlgebraDistribution *dist_pt, HYPRE_IJVector &hypre_ij_vector, HYPRE_ParVector &hypre_par_vector)
Definition: hypre_solver.cc:178
double timer()
returns the time in seconds after some point in past
Definition: oomph_utilities.cc:1295

References BoomerAMG, oomph::HypreHelpers::check_HYPRE_error_flag(), oomph::MPI_Helpers::communicator_pt(), oomph::HypreHelpers::create_HYPRE_Vector(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Euclid, Existing_solver, oomph::LinearAlgebraDistribution::first_row(), Hypre_distribution_pt, Hypre_error_messages, Hypre_method, i, Matrix_par, oomph::MPI_Helpers::mpi_has_been_initialised(), oomph::DoubleVector::norm(), oomph::LinearAlgebraDistribution::nrow_local(), OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Output_info, ParaSails, BiharmonicTestFunctions1::solution(), Solver, and oomph::TimingHelpers::timer().

Referenced by oomph::HyprePreconditioner::preconditioner_solve(), oomph::HypreSolver::resolve(), and oomph::HypreSolver::solve().

◆ hypre_solver_setup()

void oomph::HypreInterface::hypre_solver_setup ( )
protected

Sets up the data required for to use as an oomph-lib LinearSolver or Preconditioner. This must be called after the Hypre matrix has been generated using hypre_matrix_setup(...).

Sets up the solver data required for use in an oomph-lib LinearSolver or Preconditioner, once the Hypre matrix has been generated using hypre_matrix_setup(...).

559  {
560  // Store time
561  double t_start = TimingHelpers::timer();
562  double t_end = 0;
563 
564 
565  // reset Hypre's global error flag
567 
568  // create dummy Hypre vectors which are required for setup
569  HYPRE_IJVector dummy_sol_ij;
570  HYPRE_ParVector dummy_sol_par;
571  HYPRE_IJVector dummy_rhs_ij;
572  HYPRE_ParVector dummy_rhs_par;
574  Hypre_distribution_pt, dummy_sol_ij, dummy_sol_par);
576  Hypre_distribution_pt, dummy_rhs_ij, dummy_rhs_par);
577 
578  // Set up internal preconditioner for CG, GMRES or BiCGSTAB
579  // --------------------------------------------------------
580  if ((Hypre_method >= CG) && (Hypre_method <= BiCGStab))
581  {
582  // AMG preconditioner
584  {
585  // set up BoomerAMG
586  HYPRE_BoomerAMGCreate(&Preconditioner);
587  HYPRE_BoomerAMGSetPrintLevel(Preconditioner, AMG_print_level);
588  HYPRE_BoomerAMGSetMaxLevels(Preconditioner, AMG_max_levels);
589  HYPRE_BoomerAMGSetMaxIter(Preconditioner, 1);
590  HYPRE_BoomerAMGSetTol(Preconditioner, 0.0);
591  HYPRE_BoomerAMGSetCoarsenType(Preconditioner, AMG_coarsening);
592  HYPRE_BoomerAMGSetStrongThreshold(Preconditioner, AMG_strength);
593  HYPRE_BoomerAMGSetMaxRowSum(Preconditioner, AMG_max_row_sum);
594  HYPRE_BoomerAMGSetTruncFactor(Preconditioner, AMG_truncation);
595 
597  {
598  HYPRE_BoomerAMGSetRelaxType(Preconditioner, AMG_simple_smoother);
599  HYPRE_BoomerAMGSetNumSweeps(Preconditioner, AMG_smoother_iterations);
600 
601  // This one gives a memory leak
602  // double * relaxweight = new double[AMG_max_levels];
603 
604  // This is how they do it in a hypre demo code
605  double* relaxweight = hypre_CTAlloc(double, AMG_max_levels);
606 
607  for (unsigned i = 0; i < AMG_max_levels; i++)
608  {
609  relaxweight[i] = AMG_damping;
610  }
611  HYPRE_BoomerAMGSetRelaxWeight(Preconditioner, relaxweight);
612  }
613  else
614  {
615  HYPRE_BoomerAMGSetSmoothType(Preconditioner, AMG_complex_smoother);
616  HYPRE_BoomerAMGSetSmoothNumLevels(Preconditioner, AMG_max_levels);
617  HYPRE_BoomerAMGSetSmoothNumSweeps(Preconditioner,
619 
620  // If we are using Euclid then set up additional Euclid only options
621  if (AMG_complex_smoother == 9)
622  {
631  }
632  }
633 
635  }
636 
637  // Euclid preconditioner
638  else if (Internal_preconditioner == Euclid)
639  {
640 #ifdef OOMPH_HAS_MPI
641  HYPRE_EuclidCreate(Hypre_distribution_pt->communicator_pt()->mpi_comm(),
642  &Preconditioner);
643 #else
644  HYPRE_EuclidCreate(MPI_COMM_WORLD, &Preconditioner);
645 #endif
646 
647  // Set parameters
651  Euclid_level,
655 
657  }
658 
659  // ParaSails preconditioner
661  {
662 #ifdef OOMPH_HAS_MPI
663  HYPRE_ParaSailsCreate(
664  Hypre_distribution_pt->communicator_pt()->mpi_comm(),
665  &Preconditioner);
666 #else
667  HYPRE_ParaSailsCreate(MPI_COMM_WORLD, &Preconditioner);
668 #endif
669  HYPRE_ParaSailsSetSym(Preconditioner, ParaSails_symmetry);
670  HYPRE_ParaSailsSetParams(
672  HYPRE_ParaSailsSetFilter(Preconditioner, ParaSails_filter);
674  }
675 
676  // check error flag
678  {
679  std::ostringstream message;
680  int err = HypreHelpers::check_HYPRE_error_flag(message);
681  if (err)
682  {
683  OomphLibWarning(message.str(),
684  "HypreSolver::hypre_setup()",
686  }
687  }
688  } // end of setting up internal preconditioner
689 
690 
691  // set up solver
692  // -------------
693  t_start = TimingHelpers::timer();
694 
695  // AMG solver
696  if (Hypre_method == BoomerAMG)
697  {
698  if (Output_info)
699  {
700  oomph_info << "Setting up BoomerAMG, ";
701  }
702 
703  // set up BoomerAMG
704  HYPRE_BoomerAMGCreate(&Solver);
705  HYPRE_BoomerAMGSetPrintLevel(Solver, AMG_print_level);
706  HYPRE_BoomerAMGSetMaxLevels(Solver, AMG_max_levels);
707  HYPRE_BoomerAMGSetMaxIter(Solver, Max_iter);
708  HYPRE_BoomerAMGSetTol(Solver, Tolerance);
709  HYPRE_BoomerAMGSetCoarsenType(Solver, AMG_coarsening);
710  HYPRE_BoomerAMGSetStrongThreshold(Solver, AMG_strength);
711  HYPRE_BoomerAMGSetMaxRowSum(Solver, AMG_max_row_sum);
712  HYPRE_BoomerAMGSetTruncFactor(Solver, AMG_truncation);
713 
715  {
716  HYPRE_BoomerAMGSetRelaxType(Solver, AMG_simple_smoother);
717  HYPRE_BoomerAMGSetNumSweeps(Solver, AMG_smoother_iterations);
718 
719  // This one gives a memory leak
720  // double * relaxweight = new double[AMG_max_levels];
721 
722  // This is how they do it in a hypre demo code
723  double* relaxweight = hypre_CTAlloc(double, AMG_max_levels);
724 
725  for (unsigned i = 0; i < AMG_max_levels; i++)
726  {
727  relaxweight[i] = AMG_damping;
728  }
729  HYPRE_BoomerAMGSetRelaxWeight(Solver, relaxweight);
730  }
731  else
732  {
733  HYPRE_BoomerAMGSetSmoothType(Solver, AMG_complex_smoother);
734  HYPRE_BoomerAMGSetSmoothNumLevels(Solver, AMG_max_levels);
735  HYPRE_BoomerAMGSetSmoothNumSweeps(Solver, AMG_smoother_iterations);
736 
737  /* Other settings
738  * 6 & Schwarz smoothers & HYPRE_BoomerAMGSetDomainType,
739  * HYPRE_BoomerAMGSetOverlap, \\
740  * & & HYPRE_BoomerAMGSetVariant, HYPRE_BoomerAMGSetSchwarzRlxWeight
741  * \\
742  * 7 & Pilut & HYPRE_BoomerAMGSetDropTol, HYPRE_BoomerAMGSetMaxNzPerRow
743  * \\
744  * 8 & ParaSails & HYPRE_BoomerAMGSetSym, HYPRE_BoomerAMGSetLevel, \\
745  * & & HYPRE_BoomerAMGSetFilter, HYPRE_BoomerAMGSetThreshold \\
746  * 9 & Euclid & HYPRE_BoomerAMGSetEuclidFile \\
747  */
748 
749  // If we are using Euclid then set up additional Euclid only options
750  if (AMG_complex_smoother == 9)
751  {
760  }
761 
762  // Add any others here as required...
763  }
764 
765  // MemoryUsage::doc_memory_usage("before amg setup [solver]");
766  // MemoryUsage::insert_comment_to_continous_top("BEFORE AMG SETUP
767  // [SOLVER]");
768 
769  HYPRE_BoomerAMGSetup(Solver, Matrix_par, dummy_rhs_par, dummy_sol_par);
770 
771  // MemoryUsage::doc_memory_usage("after amg setup [solver]");
772  // MemoryUsage::insert_comment_to_continous_top("AFTER AMG SETUP
773  // [SOLVER]");
774 
776  }
777 
778  // Euclid solver
779  else if (Hypre_method == Euclid)
780  {
781  if (Output_info)
782  {
783  oomph_info << "Setting up Euclid, ";
784  }
785 #ifdef OOMPH_HAS_MPI
786  HYPRE_EuclidCreate(Hypre_distribution_pt->communicator_pt()->mpi_comm(),
787  &Solver);
788 #else
789  HYPRE_EuclidCreate(MPI_COMM_WORLD, &Solver);
790 #endif
791 
792  // Set parameters
796  Euclid_level,
800 
801  HYPRE_EuclidSetup(Solver, Matrix_par, dummy_rhs_par, dummy_sol_par);
803  }
804 
805  // ParaSails preconditioner
806  else if (Hypre_method == ParaSails)
807  {
808  if (Output_info)
809  {
810  oomph_info << "Setting up ParaSails, ";
811  }
812 #ifdef OOMPH_HAS_MPI
813  HYPRE_ParaSailsCreate(
814  Hypre_distribution_pt->communicator_pt()->mpi_comm(), &Solver);
815 #else
816  HYPRE_ParaSailsCreate(MPI_COMM_WORLD, &Solver);
817 #endif
818  HYPRE_ParaSailsSetSym(Solver, ParaSails_symmetry);
819  HYPRE_ParaSailsSetParams(Solver, ParaSails_thresh, ParaSails_nlevel);
820  HYPRE_ParaSailsSetFilter(Solver, ParaSails_filter);
821 
822  HYPRE_ParaSailsSetup(Solver, Matrix_par, dummy_rhs_par, dummy_sol_par);
824  }
825 
826  // CG solver
827  else if (Hypre_method == CG)
828  {
829  if (Output_info)
830  {
831  oomph_info << "Setting up CG, ";
832  }
833 
834 #ifdef OOMPH_HAS_MPI
835  HYPRE_ParCSRPCGCreate(
836  Hypre_distribution_pt->communicator_pt()->mpi_comm(), &Solver);
837 #else
838  HYPRE_ParCSRPCGCreate(MPI_COMM_WORLD, &Solver);
839 #endif
840  HYPRE_PCGSetTol(Solver, Tolerance);
841  HYPRE_PCGSetLogging(Solver, 0);
842  HYPRE_PCGSetPrintLevel(Solver, Krylov_print_level);
843  HYPRE_PCGSetMaxIter(Solver, Max_iter);
844 
845  // set preconditioner
846  if (Internal_preconditioner == BoomerAMG) // AMG
847  {
848  if (Output_info)
849  {
850  oomph_info << " with BoomerAMG preconditioner, ";
851  }
852 
853  HYPRE_PCGSetPrecond(Solver,
854  (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSolve,
855  (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSetup,
857  }
858  else if (Internal_preconditioner == Euclid) // Euclid
859  {
860  if (Output_info)
861  {
862  oomph_info << " with Euclid ILU preconditioner, ";
863  }
864 
865  HYPRE_PCGSetPrecond(Solver,
866  (HYPRE_PtrToSolverFcn)HYPRE_EuclidSolve,
867  (HYPRE_PtrToSolverFcn)HYPRE_EuclidSetup,
869  }
870  else if (Internal_preconditioner == ParaSails) // ParaSails
871  {
872  if (Output_info)
873  {
874  oomph_info << " with ParaSails approximate inverse preconditioner, ";
875  }
876 
877  HYPRE_PCGSetPrecond(Solver,
878  (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSolve,
879  (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSetup,
881  }
882  else
883  {
884  if (Output_info)
885  {
886  oomph_info << " with no preconditioner";
887  }
888  }
889 
890 
891  HYPRE_PCGSetup(Solver,
892  (HYPRE_Matrix)Matrix_par,
893  (HYPRE_Vector)dummy_rhs_par,
894  (HYPRE_Vector)dummy_sol_par);
895 
896 
898  }
899 
900  // GMRES solver
901  else if (Hypre_method == GMRES)
902  {
903  if (Output_info)
904  {
905  oomph_info << "Setting up GMRES";
906  }
907 
908 #ifdef OOMPH_HAS_MPI
909  HYPRE_ParCSRGMRESCreate(
910  Hypre_distribution_pt->communicator_pt()->mpi_comm(), &Solver);
911 #else
912  HYPRE_ParCSRGMRESCreate(MPI_COMM_WORLD, &Solver);
913 #endif
914  HYPRE_GMRESSetTol(Solver, Tolerance);
915  HYPRE_GMRESSetKDim(Solver, Max_iter);
916  HYPRE_GMRESSetLogging(Solver, 0);
917  HYPRE_GMRESSetPrintLevel(Solver, Krylov_print_level);
918  HYPRE_GMRESSetMaxIter(Solver, Max_iter);
919 
920  // set preconditioner
921  if (Internal_preconditioner == BoomerAMG) // AMG
922  {
923  if (Output_info)
924  {
925  oomph_info << " with BoomerAMG preconditioner, ";
926  }
927 
928  HYPRE_GMRESSetPrecond(Solver,
929  (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSolve,
930  (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSetup,
932  }
933  else if (Internal_preconditioner == Euclid) // Euclid
934  {
935  if (Output_info)
936  {
937  oomph_info << " with Euclid ILU preconditioner, ";
938  }
939 
940  HYPRE_GMRESSetPrecond(Solver,
941  (HYPRE_PtrToSolverFcn)HYPRE_EuclidSolve,
942  (HYPRE_PtrToSolverFcn)HYPRE_EuclidSetup,
944  }
945  else if (Internal_preconditioner == ParaSails) // ParaSails
946  {
947  if (Output_info)
948  {
949  oomph_info << " with ParaSails approximate inverse preconditioner, ";
950  }
951 
952  HYPRE_GMRESSetPrecond(Solver,
953  (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSolve,
954  (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSetup,
956  }
957  else
958  {
959  if (Output_info)
960  {
961  oomph_info << " with no preconditioner";
962  }
963  }
964 
965  HYPRE_GMRESSetup(Solver,
966  (HYPRE_Matrix)Matrix_par,
967  (HYPRE_Vector)dummy_rhs_par,
968  (HYPRE_Vector)dummy_sol_par);
969 
971  }
972 
973  // BiCGStab solver
974  else if (Hypre_method == BiCGStab)
975  {
976  if (Output_info)
977  {
978  oomph_info << "Setting up BiCGStab";
979  }
980 #ifdef OOMPH_HAS_MPI
981  HYPRE_ParCSRBiCGSTABCreate(
982  Hypre_distribution_pt->communicator_pt()->mpi_comm(), &Solver);
983 #else
984  HYPRE_ParCSRBiCGSTABCreate(MPI_COMM_WORLD, &Solver);
985 #endif
986  HYPRE_BiCGSTABSetTol(Solver, Tolerance);
987  HYPRE_BiCGSTABSetLogging(Solver, 0);
988  HYPRE_BiCGSTABSetPrintLevel(Solver, Krylov_print_level);
989  HYPRE_BiCGSTABSetMaxIter(Solver, Max_iter);
990 
991  // set preconditioner
992  if (Internal_preconditioner == BoomerAMG) // AMG
993  {
994  if (Output_info)
995  {
996  oomph_info << " with BoomerAMG preconditioner, ";
997  }
998 
999  HYPRE_BiCGSTABSetPrecond(Solver,
1000  (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSolve,
1001  (HYPRE_PtrToSolverFcn)HYPRE_BoomerAMGSetup,
1002  Preconditioner);
1003  }
1004  else if (Internal_preconditioner == Euclid) // Euclid
1005  {
1006  if (Output_info)
1007  {
1008  oomph_info << " with Euclid ILU preconditioner, ";
1009  }
1010 
1011  HYPRE_BiCGSTABSetPrecond(Solver,
1012  (HYPRE_PtrToSolverFcn)HYPRE_EuclidSolve,
1013  (HYPRE_PtrToSolverFcn)HYPRE_EuclidSetup,
1014  Preconditioner);
1015  }
1016  else if (Internal_preconditioner == ParaSails) // ParaSails
1017  {
1018  if (Output_info)
1019  {
1020  oomph_info << " with ParaSails approximate inverse preconditioner, ";
1021  }
1022 
1023  HYPRE_BiCGSTABSetPrecond(Solver,
1024  (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSolve,
1025  (HYPRE_PtrToSolverFcn)HYPRE_ParaSailsSetup,
1026  Preconditioner);
1027  }
1028  else
1029  {
1030  if (Output_info)
1031  {
1032  oomph_info << " with no preconditioner, ";
1033  }
1034  }
1035 
1036  HYPRE_BiCGSTABSetup(Solver,
1037  (HYPRE_Matrix)Matrix_par,
1038  (HYPRE_Vector)dummy_rhs_par,
1039  (HYPRE_Vector)dummy_sol_par);
1040 
1042  }
1043 
1044  // no solver exists for this value of Solver flag
1045  else
1046  {
1047  std::ostringstream error_message;
1048  error_message << "Solver has been set to an invalid value. "
1049  << "current value=" << Solver;
1050  throw OomphLibError(
1051  error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1052  }
1053 
1054  t_end = TimingHelpers::timer();
1055  double solver_setup_time = t_end - t_start;
1056 
1057  // destroy dummy hypre vectors
1058  HYPRE_IJVectorDestroy(dummy_sol_ij);
1059  HYPRE_IJVectorDestroy(dummy_rhs_ij);
1060 
1061  // check error flag
1063  {
1064  std::ostringstream message;
1065  int err = HypreHelpers::check_HYPRE_error_flag(message);
1066  if (err)
1067  {
1068  OomphLibWarning(message.str(),
1069  "HypreSolver::hypre_solver_setup()",
1071  }
1072  }
1073 
1074  // output times
1075  if (Output_info)
1076  {
1077  oomph_info << "time for setup [s] : " << solver_setup_time << std::endl;
1078  }
1079  }
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
Definition: linear_algebra_distribution.h:335
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)
Definition: hypre_solver.cc:409

References AMG_coarsening, AMG_complex_smoother, AMG_damping, AMG_max_levels, AMG_max_row_sum, AMG_print_level, AMG_simple_smoother, AMG_smoother_iterations, AMG_strength, AMG_truncation, AMG_using_simple_smoothing, AMGEuclidSmoother_drop_tol, AMGEuclidSmoother_level, AMGEuclidSmoother_print_level, AMGEuclidSmoother_use_block_jacobi, AMGEuclidSmoother_use_ilut, AMGEuclidSmoother_use_row_scaling, BiCGStab, BoomerAMG, CG, oomph::HypreHelpers::check_HYPRE_error_flag(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::HypreHelpers::create_HYPRE_Vector(), Euclid, Euclid_droptol, Euclid_level, Euclid_print_level, Euclid_rowScale, oomph::HypreHelpers::euclid_settings_helper(), Euclid_using_BJ, Euclid_using_ILUT, Existing_preconditioner, Existing_solver, GMRES, hypre__global_error, Hypre_distribution_pt, Hypre_error_messages, Hypre_method, i, Internal_preconditioner, Krylov_print_level, Matrix_par, Max_iter, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Output_info, ParaSails, ParaSails_filter, ParaSails_nlevel, ParaSails_symmetry, ParaSails_thresh, Solver, oomph::TimingHelpers::timer(), and Tolerance.

Referenced by oomph::HyprePreconditioner::setup(), and oomph::HypreSolver::solve().

◆ operator=()

void oomph::HypreInterface::operator= ( const HypreInterface )
delete

Broken assignment operator.

Member Data Documentation

◆ AMG_coarsening

unsigned oomph::HypreInterface::AMG_coarsening
protected

AMG coarsening strategy. Coarsening types include: 0 = CLJP (parallel coarsening using independent sets) 1 = classical RS with no boundary treatment (not recommended in parallel) 3 = modified RS with 3rd pass to add C points on the boundaries 6 = Falgout (uses 1 then CLJP using interior coarse points as first independent set) 8 = PMIS (parallel coarsening using independent sets - lower complexities than 0, maybe also slower convergence) 10= HMIS (one pass RS on each processor then PMIS on interior coarse points as first independent set) 11= One pass RS on each processor (not recommended)

Referenced by oomph::HypreSolver::amg_coarsening(), oomph::HyprePreconditioner::amg_coarsening(), hypre_solver_setup(), and HypreInterface().

◆ AMG_complex_smoother

unsigned oomph::HypreInterface::AMG_complex_smoother
protected

Complex smoothing methods used in BoomerAMG. Relaxation types are: 6 = Schwarz 7 = Pilut 8 = ParaSails 9 = Euclid To use these methods set AMG_using_simple_smoothing to false

Referenced by oomph::HypreSolver::amg_complex_smoother(), oomph::HyprePreconditioner::amg_complex_smoother(), hypre_solver_setup(), and HypreInterface().

◆ AMG_damping

double oomph::HypreInterface::AMG_damping
protected

Damping factor for BoomerAMG smoothed Jacobi or hybrid SOR.

Referenced by oomph::HypreSolver::amg_damping(), oomph::HyprePreconditioner::amg_damping(), hypre_solver_setup(), and HypreInterface().

◆ AMG_max_levels

unsigned oomph::HypreInterface::AMG_max_levels
protected

◆ AMG_max_row_sum

double oomph::HypreInterface::AMG_max_row_sum
protected

Parameter to identify diagonally dominant parts of the matrix in AMG.

Referenced by oomph::HypreSolver::amg_max_row_sum(), oomph::HyprePreconditioner::amg_max_row_sum(), hypre_solver_setup(), and HypreInterface().

◆ AMG_print_level

unsigned oomph::HypreInterface::AMG_print_level
protected

Used to set the Hypre printing level for AMG 0: no printout 1: print setup information 2: print solve information 3: print setup and solve information

Referenced by oomph::HypreSolver::amg_print_level(), oomph::HyprePreconditioner::amg_print_level(), hypre_solver_setup(), and HypreInterface().

◆ AMG_simple_smoother

unsigned oomph::HypreInterface::AMG_simple_smoother
protected

Simple smoothing methods used in BoomerAMG. Relaxation types include: 0 = Jacobi 1 = Gauss-Seidel, sequential (very slow in parallel!) 2 = Gauss-Seidel, interior points in parallel, boundary sequential (slow in parallel!) 3 = hybrid Gauss-Seidel or SOR, forward solve 4 = hybrid Gauss-Seidel or SOR, backward solve 6 = hybrid symmetric Gauss-Seidel or SSOR To use these methods set AMG_using_simple_smoothing to true

Referenced by oomph::HypreSolver::amg_simple_smoother(), oomph::HyprePreconditioner::amg_simple_smoother(), hypre_solver_setup(), and HypreInterface().

◆ AMG_smoother_iterations

unsigned oomph::HypreInterface::AMG_smoother_iterations
protected

◆ AMG_strength

double oomph::HypreInterface::AMG_strength
protected

Connection strength threshold parameter for BoomerAMG.

Referenced by oomph::HypreSolver::amg_strength(), oomph::HyprePreconditioner::amg_strength(), hypre_solver_setup(), and HypreInterface().

◆ AMG_truncation

double oomph::HypreInterface::AMG_truncation
protected

◆ AMG_using_simple_smoothing

bool oomph::HypreInterface::AMG_using_simple_smoothing
protected

◆ AMGEuclidSmoother_drop_tol

double oomph::HypreInterface::AMGEuclidSmoother_drop_tol

◆ AMGEuclidSmoother_level

unsigned oomph::HypreInterface::AMGEuclidSmoother_level

◆ AMGEuclidSmoother_print_level

unsigned oomph::HypreInterface::AMGEuclidSmoother_print_level

◆ AMGEuclidSmoother_use_block_jacobi

bool oomph::HypreInterface::AMGEuclidSmoother_use_block_jacobi

◆ AMGEuclidSmoother_use_ilut

bool oomph::HypreInterface::AMGEuclidSmoother_use_ilut

◆ AMGEuclidSmoother_use_row_scaling

bool oomph::HypreInterface::AMGEuclidSmoother_use_row_scaling

◆ Delete_input_data

bool oomph::HypreInterface::Delete_input_data
protected

Internal flag which is true when hypre_setup or hypre_solve can delete input matrix.

Referenced by hypre_matrix_setup(), oomph::HyprePreconditioner::setup(), and oomph::HypreSolver::solve().

◆ Delete_matrix

bool oomph::HypreInterface::Delete_matrix
private

Hypre copies matrix data from oomph-lib's CRDoubleMatrix into its own data structures, doubling the memory requirements. As far as the Hypre solvers are concerned the oomph-lib matrix is no longer required and could be deleted to save memory. However, this will not be the expected behaviour and therefore needs to be requested explicitly by the user by changing this flag from false (its default) to true.

◆ Euclid_droptol

double oomph::HypreInterface::Euclid_droptol
protected

Euclid drop tolerance for ILU(k) and ILUT factorization.

Referenced by oomph::HypreSolver::euclid_droptol(), oomph::HyprePreconditioner::euclid_droptol(), hypre_solver_setup(), and HypreInterface().

◆ Euclid_level

int oomph::HypreInterface::Euclid_level
protected

Euclid level parameter for ILU(k) factorization.

Referenced by oomph::HypreSolver::euclid_level(), oomph::HyprePreconditioner::euclid_level(), hypre_solver_setup(), and HypreInterface().

◆ Euclid_print_level

unsigned oomph::HypreInterface::Euclid_print_level
protected

Flag to set the level of printing from Euclid when the Euclid destructor is called 0: no printing (default) 1: prints summary of runtime settings and timings 2: as 1 plus prints memory usage

Referenced by oomph::HypreSolver::euclid_print_level(), oomph::HyprePreconditioner::euclid_print_level(), hypre_solver_setup(), and HypreInterface().

◆ Euclid_rowScale

◆ Euclid_using_BJ

◆ Euclid_using_ILUT

bool oomph::HypreInterface::Euclid_using_ILUT
protected

◆ Existing_preconditioner

unsigned oomph::HypreInterface::Existing_preconditioner
private

Used to keep track of which preconditioner (if any) is currently stored.

Referenced by existing_preconditioner(), hypre_clean_up_memory(), hypre_solver_setup(), and HypreInterface().

◆ Existing_solver

unsigned oomph::HypreInterface::Existing_solver
private

Used to keep track of which solver (if any) is currently stored.

Referenced by existing_solver(), hypre_clean_up_memory(), hypre_solve(), hypre_solver_setup(), and HypreInterface().

◆ Hypre_distribution_pt

LinearAlgebraDistribution* oomph::HypreInterface::Hypre_distribution_pt
private

the distribution for this helpers-

Referenced by hypre_matrix_setup(), hypre_solve(), hypre_solver_setup(), HypreInterface(), and ~HypreInterface().

◆ Hypre_error_messages

bool oomph::HypreInterface::Hypre_error_messages
protected

Flag to determine if non-zero values of the Hypre error flag plus Hypre error messages are output to screen at various points in the solve function, i.e. after:

  1. setting up the Hypre matrix
  2. setting up the preconditioner
  3. setting up the solver
  4. setting up the Hypre vectors
  5. solving
  6. getting the solution vector
  7. deallocation of solver data

Referenced by disable_hypre_error_messages(), enable_hypre_error_messages(), hypre_clean_up_memory(), hypre_matrix_setup(), hypre_solve(), hypre_solver_setup(), and HypreInterface().

◆ Hypre_method

◆ Internal_preconditioner

unsigned oomph::HypreInterface::Internal_preconditioner
protected

Preconditioner method flag used with Hypre's PCG, GMRES and BiCGStab in solve(...) or resolve(...). Valid values are BoomerAMG, Euclid, ParaSails or None (all enumerated above), for any other value no preconditioner is set.

Referenced by hypre_solver_setup(), HypreInterface(), oomph::HyprePreconditioner::HyprePreconditioner(), oomph::HypreSolver::internal_preconditioner(), and oomph::HyprePreconditioner::internal_preconditioner().

◆ Krylov_print_level

unsigned oomph::HypreInterface::Krylov_print_level
protected

Used to set the Hypre printing level for the Krylov subspace solvers

Referenced by hypre_solver_setup(), HypreInterface(), and oomph::HypreSolver::krylov_print_level().

◆ Matrix_ij

HYPRE_IJMatrix oomph::HypreInterface::Matrix_ij
private

The Hypre_IJMatrix version of the matrix used in solve(...), resolve(...) or preconditioner_solve(...).

Referenced by hypre_clean_up_memory(), and hypre_matrix_setup().

◆ Matrix_par

HYPRE_ParCSRMatrix oomph::HypreInterface::Matrix_par
private

The Hypre_ParCSRMatrix version of the matrix used in solve(...), resolve(...) or preconditioner_solve(...).

Referenced by hypre_matrix_setup(), hypre_solve(), and hypre_solver_setup().

◆ Max_iter

◆ Output_info

bool oomph::HypreInterface::Output_info
protected

◆ ParaSails_filter

double oomph::HypreInterface::ParaSails_filter
protected

◆ ParaSails_nlevel

int oomph::HypreInterface::ParaSails_nlevel
protected

◆ ParaSails_symmetry

int oomph::HypreInterface::ParaSails_symmetry
protected

ParaSails symmetry flag, used to inform ParaSails of Symmetry of definitenss of problem and type of ParaSails preconditioner: 0 = nonsymmetric and/or indefinite problem, nonsymmetric preconditioner 1 = SPD problem, and SPD (factored preconditioner) 2 = nonsymmetric, definite problem and SDP (factored preconditoner)

Referenced by hypre_solver_setup(), HypreInterface(), oomph::HypreSolver::parasails_symmetry(), and oomph::HyprePreconditioner::parasails_symmetry().

◆ ParaSails_thresh

double oomph::HypreInterface::ParaSails_thresh
protected

◆ Preconditioner

HYPRE_Solver oomph::HypreInterface::Preconditioner
private

The internal Hypre preconditioner used in conjunction with Solver. [This is a C structure!]

◆ Solver

HYPRE_Solver oomph::HypreInterface::Solver
private

The Hypre solver used in solve(...), resolve(...) or preconditioner_solve(...). [This is a C structure!]

Referenced by hypre_clean_up_memory(), hypre_solve(), and hypre_solver_setup().

◆ Tolerance

double oomph::HypreInterface::Tolerance
protected

The documentation for this class was generated from the following files: