68 "Newton solver with trust-region clipped step.");
80 pSession->LoadParameter(
"TrustRegionRhoAccept",
m_rhoAccept, 1.0e-1);
81 pSession->LoadParameter(
"TrustRegionRhoShrink",
m_rhoShrink, 2.5e-1);
82 pSession->LoadParameter(
"TrustRegionRhoGrow",
m_rhoGrow, 7.5e-1);
83 pSession->LoadParameter(
"TrustRegionShrinkFactor",
m_shrinkFactor, 0.5);
84 pSession->LoadParameter(
"TrustRegionGrowFactor",
m_growFactor, 2.0);
87 pSession->LoadParameter(
"TrustRegionMaxFallbackResidualGrowth",
111 const int ntotal,
const NekDouble oldResNorm)
117 cout <<
" Attempting to apply Newton update Trust Region "
118 <<
" Trust radius = " << trustRadiusTrial
119 <<
" deltaNorm = " << deltaNorm <<
" oldResNorm= " << oldResNorm
126 cout <<
" Trust region test " << it <<
" of "
131 bool boundaryStep =
false;
132 if (deltaNorm > trustRadiusTrial)
134 NekDouble scale = trustRadiusTrial / deltaNorm;
139 cout <<
" deltaNorm > trustRadiusTrial - Boundary Step" << endl;
144 (deltaNorm > 1.0e-14) ? (trialNorm / deltaNorm) : 1.0;
158 std::max(1.0e-14 * oldResNorm, 0.5 * alphaPred * oldResNorm);
159 NekDouble ared = oldResNorm - newResNorm;
164 cout <<
" TrustRadius trial = " << trustRadiusTrial
165 <<
" stepNorm = " << trialNorm <<
" oldRes = " << oldResNorm
166 <<
" newRes = " << newResNorm <<
" ared = " << ared
167 <<
" pred = " << pred <<
" rho = " << rho << endl;
172 cout <<
" Accepting step with rho = " << rho
182 cout <<
"Trust radius shrink with m_rhoShrink=" <<
m_rhoShrink
187 else if (rho >
m_rhoGrow && boundaryStep)
189 cout <<
"Trust radius grow with m_rhoGrow=" <<
m_rhoGrow
207 cout <<
"Failed to find a correct step "
208 <<
" Fallback: force a minimum-radius step and continue." << endl;
228 cout <<
" No acceptable trust-region step found."
230 <<
" residual = " << fallbackResNorm << endl;
232 if (!std::isfinite(fallbackResNorm) ||
236 "Fallback trust-region step caused non-finite or excessive "
#define WARNINGL0(condition, msg)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Array< OneD, NekDouble > m_Residual
Array< OneD, NekDouble > m_Solution
Array< OneD, NekDouble > m_DeltSltn
void v_InitObject() override
bool m_haveUpdatedResidual
Array< OneD, NekDouble > m_solutionTrial
NekDouble m_maxFallbackResidualGrowth
NekDouble m_trustRadiusMax
int m_maxTrustRegionSteps
static std::string className
bool v_ApplyNewtonUpdate(const int ntotal, const NekDouble oldResNorm) override
void v_InitObject() override
NekDouble m_trustRadiusInit
Array< OneD, NekDouble > m_deltaTrial
NekDouble CalcL2Norm(const int ntotal, const Array< OneD, const NekDouble > &x) const
NekNonlinSysIterNewtonTrustRegion(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vComm, const int nDimen, const NekSysKey &pKey)
static NekNonlinSysIterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vComm, const int nDimen, const NekSysKey &pKey)
NekDouble m_trustRadiusMin
Array< OneD, NekDouble > m_residualTrial
LibUtilities::CommSharedPtr m_rowComm
NekSysOperators m_operator
void DoNekSysResEval(InArrayType &inarray, OutArrayType &outarray, const bool &flag=false) const
NekNonlinSysIterFactory & GetNekNonlinSysIterFactory()
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
T Dot(int n, const T *w, const T *x)
dot product
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
scalarT< T > sqrt(scalarT< T > in)