46 #include <Xyce_config.h>
52 #include <N_UTL_Misc.h>
55 #include "N_LAS_Vector.h"
56 #include "N_LOA_Loader.h"
58 #include "NOX_Solver_LineSearchBased.H"
62 using namespace N_NLS_NOX;
69 N_LAS_Vector** currSolVectorPtrPtr,
79 int checkDeviceConvergence,
80 double smallUpdateTol,
82 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
83 ,
bool nonTrivialDeviceMaskFlag,
84 N_LAS_Vector * maskVectorPtr
88 status_(NOX::StatusTest::Unconverged),
90 isTransient_(isTransient),
94 requestedMaxNormF_(normF),
95 requestedMachPrecTol_(machPrec),
96 oldTimeStepVectorPtrPtr_(currSolVectorPtrPtr),
100 epsilon_a_(epsilon_a),
101 epsilon_r_(epsilon_r),
103 weightedUpdate_(0.0),
105 requestedConvRate_(convRate),
106 currentConvRate_(1.0),
107 requestedRelativeConvRate_(relConvRate),
108 currentRelativeConvRate_(1.0),
109 normResidualInit_(1.0),
110 maxConvRate_(maxConvRate),
114 stagnationTol_(stagnationTol),
115 maxBadSteps_(maxBadSteps),
117 smallUpdateTol_(smallUpdateTol),
118 checkDeviceConvergence_(checkDeviceConvergence),
120 allDevicesConverged_(false),
121 innerDevicesConverged_(false)
122 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
123 , deviceMaskFlag_( false ),
124 weightMaskVectorPtr_( maskVectorPtr)
143 NOX::StatusTest::CheckType checkType)
145 status_ = NOX::StatusTest::Unconverged;
147 niters_ = problem.getNumIterations();
177 (problem.getSolutionGroup().getX())).getNativeVectorRef();
179 (problem.getPreviousSolutionGroup().getX())).getNativeVectorRef();
182 NOX::StatusTest::StatusType check =
finiteTest_.checkStatus(problem,
184 if (check == NOX::StatusTest::Failed)
198 status_ = NOX::StatusTest::Failed;
210 status_ = NOX::StatusTest::Unconverged;
218 maxNormF_ = problem.getSolutionGroup().getF()
219 .norm(NOX::Abstract::Vector::MaxNorm);
222 (problem.getSolutionGroup().getF())).getNativeVectorRef();
224 std::vector<int> index(1, -1);
225 F.infNormIndex( &index[0] );
231 status_ = NOX::StatusTest::Converged;
253 for (
int i=0; i< x.localLength() ; ++i )
271 int length = x.localLength();
272 for (
int i = 0; i < length; ++i )
277 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
278 if( deviceMaskFlag_ && ((*weightMaskVectorPtr_)[i] == 0.0) )
280 weights[i] = N_UTL_MachineDependentParams::MachineBig();
295 update.update(1.0, x, -1.0, oldX, 0.0);
298 #ifdef Xyce_SPICE_NORMS
307 const NOX::Solver::LineSearchBased* test = 0;
308 test =
dynamic_cast<const NOX::Solver::LineSearchBased*
>(&problem);
326 if (!(problem.getPreviousSolutionGroup().isNewton()))
328 NOX::Abstract::Group & tmpGrp =
329 (
const_cast<NOX::Abstract::Group&
>(problem.getPreviousSolutionGroup()));
330 Teuchos::ParameterList tmpParams;
331 tmpGrp.computeNewton (tmpParams);
335 (problem.getPreviousSolutionGroup().getNewton())).getNativeVectorRef();
341 status_ = NOX::StatusTest::Failed;
350 status_ = NOX::StatusTest::Converged;
366 (problem.getPreviousSolutionGroup().getNormF());
391 status_ = NOX::StatusTest::Converged;
395 status_ = NOX::StatusTest::Failed;
397 status_ = NOX::StatusTest::Converged;
401 status_ = NOX::StatusTest::Failed;
416 status_ = NOX::StatusTest::Failed;
421 status_ = NOX::StatusTest::Unconverged;
436 status_ = NOX::StatusTest::Failed;
445 status_ = NOX::StatusTest::Failed;
465 bool isCounted =
false;
496 status_ = NOX::StatusTest::Converged;
503 status_ = NOX::StatusTest::Failed;
505 status_ = NOX::StatusTest::Converged;
509 status_ = NOX::StatusTest::Failed;
524 for (
int j = 0; j < indent; ++j )
535 for (
int j = 0; j < indent; ++j )
537 stream <<
"8. Devices are Converged: ";
539 stream <<
"true" <<
"\n";
541 stream <<
"false" <<
"\n";
544 for (
int j = 0; j < indent; ++j )
546 stream <<
"1. Inf-Norm F too small" <<
"\n";
548 for (
int j = 0; j < indent; ++j )
550 stream <<
" Machine Precision: " << NOX::Utils::sciformat(
maxNormF_, p)
553 for (
int j = 0; j < indent; ++j )
555 stream <<
" Requested Tolerance: " << NOX::Utils::sciformat(
maxNormF_, p)
558 for (
int j = 0; j < indent; ++j )
560 stream <<
"2. Normal Convergence" <<
"\n";
562 for (
int j = 0; j < indent; ++j )
564 stream <<
" Inf-Norm F: " << NOX::Utils::sciformat(
maxNormF_, p)
567 for (
int j = 0; j < indent; ++j )
569 stream <<
" Weighted Update: " << NOX::Utils::sciformat(
weightedUpdate_, p)
570 <<
" < " << NOX::Utils::sciformat(
tol_, p) <<
"\n";
572 for (
int j = 0; j < indent; ++j )
574 stream <<
"3. Near Convergence" <<
"\n";
576 for (
int j = 0; j < indent; ++j )
578 stream <<
" Max Iters: " <<
niters_
581 for (
int j = 0; j < indent; ++j )
583 stream <<
" Convergence Rate: "
587 for (
int j = 0; j < indent; ++j )
589 stream <<
" Relative Convergence Rate: "
594 for (
int j = 0; j < indent; ++j )
596 stream <<
"4. Small Weighted Update: "
602 for (
int j = 0; j < indent; ++j )
604 stream <<
"5. Maximum Iterations: "
606 <<
" < " << maxIters_ <<
"\n";
608 for (
int j = 0; j < indent; ++j )
610 stream <<
"6. Large Conv Rate: "
612 <<
" < " << NOX::Utils::sciformat(
maxConvRate_, p) <<
"\n";
615 for (
int j = 0; j < indent; ++j )
617 stream <<
"7. Stagnation " <<
"\n";
619 for (
int j = 0; j < indent; ++j )
621 stream <<
" Bad Step Count: "
624 for (
int j = 0; j < indent; ++j )
626 stream <<
" Stagnation Tolerance: "