Chombo + EB
3.2
|
#include <GMRESSolver.H>
Public Member Functions | |
GMRESSolver () | |
virtual | ~GMRESSolver () |
void | clearData () |
virtual void | setHomogeneous (bool a_homogeneous) |
virtual void | setConvergenceMetrics (Real a_metric, Real a_tolerance) |
Set a convergence metric, along with solver tolerance, if desired. More... | |
virtual void | define (LinearOp< T > *a_op, bool a_homogeneous=true) |
virtual void | solve (T &a_phi, const T &a_rhs) |
solve the equation. More... | |
int | restartLen () const |
void | setRestartLen (int mm) |
Public Member Functions inherited from LinearSolver< T > | |
virtual | ~LinearSolver () |
Public Attributes | |
bool | m_homogeneous |
int | m_iter |
Real | m_residual |
Real | m_initial_residual |
LinearOp< T > * | m_op |
int | m_imax |
int | m_verbosity |
Real | m_eps |
Real | m_reps |
int | m_exitStatus |
Real | m_small |
int | m_normType |
Private Member Functions | |
void | allocate () |
void | CycleGMRES (T &xx, int &reason, int &itcount, Real &rnorm0, const bool avoidnorms=false) |
void | ResidualGMRES (T &a_vv, const T &a_xx, const T &a_bb, T &a_temp) |
void | BuildGMRESSoln (Real nrs[], T &a_xx, const int it, const T vv_0[]) |
void | UpdateGMRESHessenberg (const int it, bool hapend, Real &res) |
void | TwoUnmodifiedGramSchmidtOrthogonalization (const int it) |
void | ApplyAB (T &a_dest, const T &a_xx, T &a_temp) const |
Private Attributes | |
int | m_restrtLen |
Real * | m_data |
Real * | m_hes |
Real * | m_hh |
Real * | m_d |
Real * | m_ee |
Real * | m_dd |
T * | m_work_arr |
Krylov solver using the GMRES algorithm. Important parmeters are: 1) relative tolerance: m_reps(1.e-12) 2) restart length: m_restrtLen(30)
GMRESSolver< T >::GMRESSolver | ( | ) |
References GMRESSolver< T >::allocate().
|
virtual |
References GMRESSolver< T >::clearData(), and GMRESSolver< T >::m_op.
void GMRESSolver< T >::clearData | ( | ) |
References GMRESSolver< T >::m_data.
Referenced by GMRESSolver< T >::setRestartLen(), and GMRESSolver< T >::~GMRESSolver().
|
inlinevirtual |
reset whether the solver is homogeneous.
Implements LinearSolver< T >.
References GMRESSolver< T >::define(), GMRESSolver< T >::m_homogeneous, GMRESSolver< T >::setConvergenceMetrics(), and GMRESSolver< T >::solve().
|
virtual |
Set a convergence metric, along with solver tolerance, if desired.
Default implementation does nothing, since there are probably cases (liked direct solves), where this has no real meaning.
Reimplemented from LinearSolver< T >.
References GMRESSolver< T >::m_eps.
Referenced by GMRESSolver< T >::setHomogeneous().
|
virtual |
define the solver. a_op is the linear operator. a_homogeneous is whether the solver uses homogeneous boundary conditions.
Implements LinearSolver< T >.
References GMRESSolver< T >::m_homogeneous, and GMRESSolver< T >::m_op.
Referenced by GMRESSolver< T >::setHomogeneous().
|
virtual |
solve the equation.
m_exitStatus set = -1 if solver exited for an unknown reason set = 1 if solver converged to tolerance set = 2 if rho = 0 set = 3 if max number of restarts was reached
Implements LinearSolver< T >.
References CH_START, CH_STOP, CH_TIMER, CH_TIMERS, GMRESSolver< T >::CycleGMRES(), GMRESSolver< T >::m_exitStatus, GMRESSolver< T >::m_homogeneous, GMRESSolver< T >::m_imax, GMRESSolver< T >::m_initial_residual, GMRESSolver< T >::m_iter, GMRESSolver< T >::m_op, GMRESSolver< T >::m_restrtLen, GMRESSolver< T >::m_verbosity, GMRESSolver< T >::m_work_arr, pout(), GMRESSolver< T >::ResidualGMRES(), VEC_OFFSET, VEC_TEMP_LHS, VEC_TEMP_RHS, and VEC_VV.
Referenced by GMRESSolver< T >::setHomogeneous().
|
inline |
References GMRESSolver< T >::m_restrtLen, and GMRESSolver< T >::setRestartLen().
void GMRESSolver< T >::setRestartLen | ( | int | mm | ) |
References GMRESSolver< T >::allocate(), CH_assert, GMRESSolver< T >::clearData(), and GMRESSolver< T >::m_restrtLen.
Referenced by GMRESSolver< T >::restartLen().
|
private |
References GMRESSolver< T >::m_d, GMRESSolver< T >::m_data, GMRESSolver< T >::m_dd, GMRESSolver< T >::m_ee, GMRESSolver< T >::m_hes, GMRESSolver< T >::m_hh, GMRESSolver< T >::m_restrtLen, and GMRESSolver< T >::m_work_arr.
Referenced by GMRESSolver< T >::GMRESSolver(), and GMRESSolver< T >::setRestartLen().
|
private |
References GMRESSolver< T >::ApplyAB(), GMRESSolver< T >::BuildGMRESSoln(), CH_assert, CONVERGED, GRS, HES, HH, GMRESSolver< T >::m_imax, GMRESSolver< T >::m_normType, GMRESSolver< T >::m_op, GMRESSolver< T >::m_residual, GMRESSolver< T >::m_restrtLen, GMRESSolver< T >::m_verbosity, pout(), GMRESSolver< T >::TwoUnmodifiedGramSchmidtOrthogonalization(), GMRESSolver< T >::UpdateGMRESHessenberg(), VEC_TEMP_LHS, and VEC_VV.
Referenced by GMRESSolver< T >::solve().
|
private |
References CH_assert, GMRESSolver< T >::m_homogeneous, and GMRESSolver< T >::m_op.
Referenced by GMRESSolver< T >::solve().
|
private |
References GRS, HH, GMRESSolver< T >::m_op, pout(), VEC_TEMP_LHS, and VEC_TEMP_RHS.
Referenced by GMRESSolver< T >::CycleGMRES().
|
private |
|
private |
References HES, HH, GMRESSolver< T >::m_op, and VEC_VV.
Referenced by GMRESSolver< T >::CycleGMRES().
|
private |
References GMRESSolver< T >::m_homogeneous, and GMRESSolver< T >::m_op.
Referenced by GMRESSolver< T >::CycleGMRES().
bool GMRESSolver< T >::m_homogeneous |
public member data: whether the solver is restricted to homogeneous boundary conditions
Referenced by GMRESSolver< T >::ApplyAB(), GMRESSolver< T >::define(), GMRESSolver< T >::ResidualGMRES(), GMRESSolver< T >::setHomogeneous(), and GMRESSolver< T >::solve().
int GMRESSolver< T >::m_iter |
public member data: iteration number. This is a member so that it can be queried after a solve, for example.
Referenced by GMRESSolver< T >::solve().
Real GMRESSolver< T >::m_residual |
public member data: current residual norm. This is a member so that it can be queried after a solve, for example
Referenced by GMRESSolver< T >::CycleGMRES().
Real GMRESSolver< T >::m_initial_residual |
public member data: initial residual norm. This is a member so that it can be queried after a solve, for example
Referenced by GMRESSolver< T >::solve().
LinearOp<T>* GMRESSolver< T >::m_op |
public member data: operator to solve.
Referenced by GMRESSolver< T >::ApplyAB(), GMRESSolver< T >::BuildGMRESSoln(), GMRESSolver< T >::CycleGMRES(), GMRESSolver< T >::define(), GMRESSolver< T >::ResidualGMRES(), GMRESSolver< T >::solve(), GMRESSolver< T >::TwoUnmodifiedGramSchmidtOrthogonalization(), and GMRESSolver< T >::~GMRESSolver().
|
private |
private member data: restart length, need to allocate stuff
Referenced by GMRESSolver< T >::allocate(), GMRESSolver< T >::CycleGMRES(), GMRESSolver< T >::restartLen(), GMRESSolver< T >::setRestartLen(), and GMRESSolver< T >::solve().
int GMRESSolver< T >::m_imax |
public member data: max iterations (eg, >= m_restrtLen)
Referenced by GMRESSolver< T >::CycleGMRES(), and GMRESSolver< T >::solve().
int GMRESSolver< T >::m_verbosity |
public member data: how much screen out put the user wants. set = 0 for no output.
Referenced by GMRESSolver< T >::CycleGMRES(), and GMRESSolver< T >::solve().
Real GMRESSolver< T >::m_eps |
public member data: solver tolerance
Referenced by GMRESSolver< T >::setConvergenceMetrics().
Real GMRESSolver< T >::m_reps |
public member data: relative solver tolerance
int GMRESSolver< T >::m_exitStatus |
public member data: set = -1 if solver exited for an unknown reason set = 1 if solver converged to tolerance set = 2 if rho = 0 set = 3 if max number of restarts was reached
Referenced by GMRESSolver< T >::solve().
Real GMRESSolver< T >::m_small |
public member data: what the algorithm should consider "close to zero"
int GMRESSolver< T >::m_normType |
Referenced by GMRESSolver< T >::CycleGMRES().
|
private |
Referenced by GMRESSolver< T >::allocate(), and GMRESSolver< T >::clearData().
|
private |
Referenced by GMRESSolver< T >::allocate().
|
private |
Referenced by GMRESSolver< T >::allocate().
|
private |
Referenced by GMRESSolver< T >::allocate().
|
private |
Referenced by GMRESSolver< T >::allocate().
|
private |
Referenced by GMRESSolver< T >::allocate().
|
private |
Referenced by GMRESSolver< T >::allocate(), and GMRESSolver< T >::solve().