Overture  Version 25
OgesParameters.h
Go to the documentation of this file.
1 #ifndef OGES_PARAMETERS_H
2 #define OGES_PARAMETERS_H
3 
4 // This class holds parameters used by Oges.
5 // You can save commonly used parameter values in an object of this class.
6 // You can interactively update parameter values.
7 // To make these parameters known to a particular Oges object, use the
8 // setOgesParameters function.
9 
10 #include "Overture.h"
11 #include "ShowFileParameter.h"
12 
13 class Oges; // forward declaration
15 class Ogmg;
16 class OgmgParameters;
17 
19 {
20  public:
21 
23  {
26  divScalarGradOperator, // div( s(x) grad )
27  heatEquationOperator, // I + c0*Delta
28  variableHeatEquationOperator, // I + s(x)*Delta
29  divScalarGradHeatEquationOperator, // I + div( s(x) grad )
31  };
32 
33  enum BoundaryConditionEnum // these are possible boundary conditions for pre-defined equations.
34  { // **The first few entries should match those in OgmgParameters.h**
37  mixed=3,
38  equation=4, // for ogmg
40  combination=6, // for ogmg
44  };
45 
46 
47  enum OptionEnum // ** remember to change the documentation if you change this list.
48  {
50  THEisAxisymmetric, // for predefined equations
51  THEbestIterativeSolver, // choose the 'best' iterative solver and options.
52  THEbestDirectSolver, // choose the 'best' direct solver and options.
61  THEincompleteLUDropTolerance, // =dt for ILUT(dt), ILUTK(dt,k) (from DH preconditioners)
62  THEincompleteLUSparseACoefficient, // =sparseA for sparsifying matrix prior to ILU (from DH)
63  THEincompleteLUSparseFCoefficient, // =sparseF for sparsifying factorization after ILU (from DH)
64  THEincompleteLUTypeInDH, // =ilu_type in DH preconditioners
66  THEkeepCoefficientGridFunction, // keep a reference to the user's coeff grid function
67  THEkeepSparseMatrix, // keep ia,ja,a sparse matrix even it not needed by the solver
75  THEorderOfExtrapolation, // for predefined equation ghost points
81  THEremoveSolutionAndRHSVector, // de-allocate sol and rhs vector after every solve
82  THEremoveSparseMatrixFactorization, // de-allocate any factorization info after every solve.
90  };
91 
93  {
95  sor,
101  PETScNew, // new parallel solver
102  userSolver1, // these are reserved for new user defined solvers.
107  };
108 
109 
111  {
116  cg=conjugateGradient, // cg= short PETSc name
128  transposeFreeQuasiMinimalResidual2, // tcqmr Tony Chan's version
135  qcg // minimize a quadratic function
136  };
137 
139  {
153  kspPreconditioner, // was slesPreconditioner
169  };
170 
171 
172 
174  {
182  };
183 
184 
185  // there are different options we can use for the external solver with PETSc
187  {
194  };
195 
196 
197  OgesParameters();
198  ~OgesParameters();
200 
201  aString getSolverName() const; // return the name (composite of solver, preconditioner,...)
202  aString getSolverTypeName(SolverEnum solverType = defaultSolver) const;
206 
207  int setParameters( const Oges & oges); // set all parameters equal to those values found in oges.
208  int update( GenericGraphicsInterface & gi, CompositeGrid & cg ); // update parameters interactively
209 
210  // ----------------Functions to set parameters -----------------------------
211  int set( SolverEnum option );
212  int set( SolverMethodEnum option );
213  int set( MatrixOrderingEnum option );
214  int set( PreconditionerEnum option );
215 
216  int set( OptionEnum option, int value=0 );
217  int set( OptionEnum option, float value );
218  int set( OptionEnum option, double value );
219 
220  // set a PETSc option
221  int setPetscOption( const aString & name, const aString & value );
222  bool getPetscOption( const aString & name, aString & value ) const;
223 
224 
225  SolverEnum getSolverType() const;
226 
227  int get( OptionEnum option, int & value ) const;
228  int get( OptionEnum option, real & value ) const;
229 
232 
233  int get( const GenericDataBase & dir, const aString & name);
234  int put( GenericDataBase & dir, const aString & name) const;
235 
236  int isAvailable( SolverEnum solverType );
237 
238  // print out current values of parameters
239  int display(FILE *file = stdout);
240 
241  ListOfShowFileParameters petscOptions; // holds options for PETSc
242 
243  protected:
244 
245  int set( OptionEnum option, int value, real rvalue );
246  int get( OptionEnum option, int & value, real & rvalue ) const;
247 
250 
255 
256  real relativeTolerance; // relative tolerance. if <=0. routine should choose a value.
258  real maximumAllowableIncreaseInResidual; // stop iterations if residual increases greater than this value.
259 
261  bool userSuppliedCompatibilityConstraint; // set to true if the user has supplied a right null vector
262 
270 
271  int blockSize; // block size for block matrices (e.g. for systems of equations)
272 
274  bool fixupRightHandSide; // zero out rhs at interp., extrap and periodic Points?
275 
276  real zeroRatio; // zratio
277  real fillinRatio; // fratio
278  real fillinRatio2; // fratio2
279  real harwellPivotingTolerance; // tolerance for harwell pivoting
281 
286 
287  int orderOfExtrapolation; // for predefined equations (-1: use default)
288 
289  real sorOmega; // omega
290 
291  int isAxisymmetric; // is this problem axisymmetric (for predefined equations)
292 
293  // parameters for experimental DH preconditioner, used with PETSc **pf**
294  real incompleteLUDropTolerance; // =dt for ILUT(dt), ILUTK(dt,k) (from DH preconditioners)
295  real incompleteLUSparseACoefficient; // =sparseA for sparsifying matrix prior to ILU (from DH)
296  real incompleteLUSparseFCoefficient; // =sparseF for sparsifying factorization after ILU (from DH)
297  int incompleteLUTypeInDH; // =ilu_type in DH preconditioners: 1=iluk with sparsify
298 
299  // parameters for memory management: These are all false by default.
300  bool keepCoefficientGridFunction; // keep a reference to the user's coeff grid function
301  bool keepSparseMatrix; // keep ia,ja,a sparse matrix even it not needed by the solver
302  bool removeSolutionAndRHSVector; // de-allocate sol and rhs vector after every solve
303  bool removeSparseMatrixFactorization; // de-allocate sparse matrix factorization after solving.
304 
306 
307  friend class Oges;
308  friend class EquationSolver;
309  friend class PETScEquationSolver;
310  friend class YaleEquationSolver;
311  friend class HarwellEquationSolver;
312  friend class SlapEquationSolver;
313  friend class Ogmg;
314  friend class PETScSolver;
315 
316 };
317 
318 #endif