|
PSCF v1.5.0
|
Anderson mixing compressor. More...
#include <AmCompressor.h>
Public Member Functions | |
| AmCompressor (System< D, T > &system) | |
| Constructor. | |
| ~AmCompressor ()=default | |
| Destructor. | |
| void | readParameters (std::istream &in) override |
| Read all parameters and initialize. | |
| void | setup (bool isContinuation) override |
| Initialize just before entry to iterative loop. | |
| int | compress () override |
| Compress to obtain partial saddle point w+. | |
| void | outputTimers (std::ostream &out) const override |
| Return compressor times contributions. | |
| void | clearTimers () override |
| Clear all timers and mde counter. | |
| Public Member Functions inherited from Pscf::AmIteratorTmpl< Compressor< D, T >, BackendArray< T::Real, T > > | |
| AmIteratorTmpl () | |
| Constructor. | |
| ~AmIteratorTmpl () | |
| Destructor. | |
| int | solve (bool isContinuation=false) |
| Iterate to a solution. | |
| void | outputTimers (std::ostream &out) const |
| Log output timing results. | |
| void | clearTimers () |
| Clear timers. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Pscf::AmIteratorTmpl< Compressor< D, T >, BackendArray< T::Real, T > > | |
| void | readErrorType (std::istream &in) |
| Read and validate the optional errorType string parameter. | |
| virtual bool | isValidErrorType () |
| Checks if a string is a valid error type. | |
| void | readMixingParameters (std::istream &in, bool useLambdaRamp=true) |
| Read optional parameters used in default correction algorithm. | |
| void | allocateAM () |
| Allocate memory required by AM algorithm, if necessary. | |
| bool | isAllocatedAM () const |
| Have data structures required by the AM algorithm been allocated? | |
| virtual void | clear () |
| Clear information about history. | |
| virtual double | computeError (T &residTrial, T &stateTrial, std::string errorType, int verbose) |
| Compute and return error used to test for convergence. | |
| double | lambdaRampFactor () |
| Compute ramped prefactor of mixing parameter lambda. | |
| virtual double | computeLambda () |
| Compute mixing parameter for correction step of Anderson mixing. | |
| int | verbose () const |
| Verbosity level, allowed values 0, 1, or 2. | |
| std::string | errorType () const |
| Get error type string. | |
| T const & | residual () const |
| Get the current residual vector by const reference. | |
| T const & | state () const |
| Return the current state vector by const reference. | |
| int | totalItr () |
| Return the total number of iterations needed to converge. | |
| double | timerTotal () |
| Get total time. | |
| double | timerMDE () |
| Get time spent solving the modified diffusion equation (MDE). | |
| double | timerAM () |
| Get total time for AM algorithm, excluding MDE solution. | |
| double | timerResid () |
| Get time spent computing residual. | |
| double | timerError () |
| Get time evaluating scalar error. | |
| double | timerCoeff () |
| Get time spent evaluating Anderson mixing coefficients. | |
| double | timerOmega () |
| Get time spent updating w states. | |
| Protected Attributes inherited from Pscf::AmIteratorTmpl< Compressor< D, T >, BackendArray< T::Real, T > > | |
| double | epsilon_ |
| Error tolerance. | |
| int | maxItr_ |
| Maximum number of iterations to attempt. | |
| int | maxHist_ |
| Maximum number of basis vectors in AM algorithm. | |
| int | verbose_ |
| Verbosity level. | |
| std::string | errorType_ |
| Type of error criterion used to test convergence. | |
Anderson mixing compressor.
Template parameters:
Definition at line 45 of file AmCompressor.h.
| Pscf::Rp::AmCompressor< D, T >::AmCompressor | ( | System< D, T > & | system | ) |
Constructor.
| system | parent System object |
Definition at line 40 of file AmCompressor.tpp.
References Util::ParamComposite::setClassName(), and Pscf::Rp::Compressor< D, T >::setSystem().
|
default |
Destructor.
References Pscf::AmIteratorTmpl< Compressor< D, T >, BackendArray< T::Real, T > >::AmIteratorTmpl(), clearTimers(), compress(), outputTimers(), readParameters(), and setup().
|
overridevirtual |
Read all parameters and initialize.
| in | input parameter file stream |
Reimplemented from Pscf::AmIteratorTmpl< Compressor< D, T >, BackendArray< T::Real, T > >.
Definition at line 51 of file AmCompressor.tpp.
References Pscf::AmIteratorTmpl< CompressorT, VectorT >::errorType_, Pscf::AmIteratorTmpl< CompressorT, VectorT >::maxItr_, Pscf::AmIteratorTmpl< CompressorT, VectorT >::readErrorType(), Pscf::AmIteratorTmpl< CompressorT, VectorT >::readMixingParameters(), Pscf::AmIteratorTmpl< CompressorT, VectorT >::readParameters(), and Pscf::AmIteratorTmpl< CompressorT, VectorT >::verbose_.
Referenced by ~AmCompressor().
|
overridevirtual |
Initialize just before entry to iterative loop.
This function is called by the solve function before entering the loop over iterations. Store the current values of the fields at the beginning of iteration
| isContinuation | true iff continuation within a sweep |
Reimplemented from Pscf::AmIteratorTmpl< Compressor< D, T >, BackendArray< T::Real, T > >.
Definition at line 68 of file AmCompressor.tpp.
References Pscf::VecOp::eqV(), and Pscf::AmIteratorTmpl< CompressorT, VectorT >::setup().
Referenced by ~AmCompressor().
|
override |
Compress to obtain partial saddle point w+.
Definition at line 97 of file AmCompressor.tpp.
References Pscf::AmIteratorTmpl< CompressorT, VectorT >::solve().
Referenced by ~AmCompressor().
|
override |
Return compressor times contributions.
| out | output stream |
Definition at line 104 of file AmCompressor.tpp.
References Pscf::AmIteratorTmpl< CompressorT, VectorT >::outputTimers().
Referenced by ~AmCompressor().
|
override |
Clear all timers and mde counter.
Definition at line 115 of file AmCompressor.tpp.
References Pscf::AmIteratorTmpl< CompressorT, VectorT >::clearTimers(), and Pscf::Rp::Compressor< D, T >::mdeCounter_.
Referenced by ~AmCompressor().