46 #include <Xyce_config.h>
63 #include "LOCA_GlobalData.H"
64 #include "LOCA_StatusTest_Wrapper.H"
65 #include "NOX_Solver_Factory.H"
72 #include "N_LAS_Solver.h"
73 #include "N_LAS_Builder.h"
74 #include "N_LAS_System.h"
75 #include "N_LAS_QueryUtil.h"
76 #include "N_LOA_Loader.h"
77 #include "N_IO_CmdParse.h"
78 #include "N_IO_OutputMgr.h"
80 #include <N_ERH_ErrorMgr.h>
82 #ifdef Xyce_PARALLEL_MPI
83 #include <N_PDS_ParComm.h>
85 #include <N_PDS_SerialComm.h>
105 dcParams_(Xyce::Nonlinear::
DC_OP),
106 transientParams_(Xyce::Nonlinear::
TRANSIENT),
107 hbParams_(Xyce::Nonlinear::
HB_MODE),
109 mode_(Xyce::Nonlinear::
DC_OP),
110 lastParametersMode_(Xyce::Nonlinear::
DC_OP),
111 parametersMode_(Xyce::Nonlinear::
DC_OP),
113 copiedGroupFlag_(false),
116 NODESETspecified_(false),
117 isFirstContinuationParam_(true),
118 firstSolveComplete_(false),
286 int myPID =
pdsMgrPtr_->getPDSComm()->procID();
291 std::vector<char> varTypeVec;
298 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
321 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
327 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
333 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
356 groupPtr_->setNonContinuationFlag (
true);
362 groupPtr_->setNonContinuationFlag (
false);
367 (*nextSolVectorPtrPtr_)->putScalar(0.0);
401 bool usedNODESET=
false;
415 #ifdef Xyce_DEBUG_NONLINEAR
416 Xyce::dout() <<
"Creating new NLS solver b/c it is 0." <<std::endl;
428 usedIC=
icCont (paramsPtr);
442 #ifdef Xyce_DEBUG_NONLINEAR
443 Xyce::dout() <<
"Creating new NLS solver b/c starting next phase, post-DC." <<std::endl;
452 #ifdef Xyce_DEBUG_NONLINEAR
453 Xyce::dout() <<
"NOT Creating new NLS solver, just resetting." <<std::endl;
458 NOX::StatusTest::StatusType status =
solverPtr_->solve();
463 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
464 groupPtr_->setAugmentLinearSystem(
false, alsNull);
467 #ifdef Xyce_DEBUG_NONLINEAR
487 std::vector<std::string> pars;
492 bool usedNODESET=
false;
499 usedIC=
icCont (paramsPtr);
511 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList =
515 LOCA::ParameterVector locaPVec;
516 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
517 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
526 if ( numParam == 0 ) {
527 std::string message =
"Using \"continuation=1\" requires a parameter to be set with the conparam keyword in the loca option block!";
528 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
531 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als;
532 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
534 std::vector<double> minValue(numParam, 0.);
535 std::vector<double> maxValue(numParam, 0.);
536 std::vector<double> initialValue(numParam, 0.);
537 std::vector<double> initialStepSize(numParam, 0.);
538 std::vector<double> minStepSize(numParam, 0.);
539 std::vector<double> maxStepSize(numParam, 0.);
540 std::vector<double> aggressiveness(numParam, 0.);
543 std::vector<std::string> paramNames(0);
544 paramNames.push_back(
"MINVALUE");
545 paramNames.push_back(
"MAXVALUE");
546 paramNames.push_back(
"INITIALVALUE");
547 paramNames.push_back(
"INITIALSTEPSIZE");
548 paramNames.push_back(
"MINSTEPSIZE");
549 paramNames.push_back(
"MAXSTEPSIZE");
550 paramNames.push_back(
"AGGRESSIVENESS");
552 for (std::size_t p = 0 ; p < paramNames.size() ; ++p) {
554 std::string msg =
"The parameter \"" +
556 "\" must have a list of values with size equal to the numParamber of parameters specified in \"conparam\".";
557 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
584 locaPVec.addParameter (pars[
iParam_], initialValue[iParam_]);
588 if (usedOP || usedNODESET)
598 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
608 stepperList.set(
"Continuation Parameter", pars[
iParam_]);
609 stepperList.set(
"Initial Value", initialValue[iParam_]);
610 stepperList.set(
"Max Value", maxValue[iParam_]);
611 stepperList.set(
"Min Value", minValue[iParam_]);
612 stepSizeList.set(
"Initial Step Size", initialStepSize[iParam_]);
613 stepSizeList.set(
"Min Step Size", minStepSize[iParam_]);
614 stepSizeList.set(
"Max Step Size", maxStepSize[iParam_]);
615 stepSizeList.set(
"Aggressiveness", aggressiveness[iParam_]);
619 locaPVec.setValue(pars[j], maxValue[j]);
621 for (j=iParam_ ; j<numParam ; ++j)
623 locaPVec.setValue(pars[j], initialValue[j]);
629 if (!usedOP && !usedNODESET)
639 if (pars[iParam_] !=
"GSTEPPING")
644 if (usedIC || usedNODESET)
646 groupPtr_->setAugmentLinearSystem(
false, alsNull);
653 std::string message =
"'.dcop input=' and gstepping are incompatible";
654 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
656 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
658 groupPtr_->setAugmentLinearSystem(
true, als);
664 groupPtr_->setAugmentLinearSystem(
false, alsNull);
668 if (locaStatus != LOCA::Abstract::Iterator::Finished)
691 bool usedNODESET=
false;
693 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
699 usedIC=
icCont (paramsPtr);
712 std::vector<std::string> pars;
721 if ( numParam > 1 ) {
722 std::string message =
"WARNING: Using \"continuation=2\" currently does not support vectorized loca parameters. Only the first values in each list will be used.";
723 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING, message);
726 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
729 std::string gain =
"mosfet:gainscale";
730 std::string nonlinear =
"mosfet:nltermscale";
733 LOCA::ParameterVector locaPVec;
734 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
735 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
736 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
740 locaPVec.addParameter(gain, 0.0);
741 locaPVec.addParameter(nonlinear, 0.0);
743 stepperList.set(
"Continuation Parameter", gain);
745 stepperList.set(
"Initial Value", 0.0);
746 stepperList.set(
"Max Value", 1.0);
747 stepperList.set(
"Min Value",-1.0);
749 stepSizeList.set(
"Initial Step Size", 0.2);
750 stepSizeList.set(
"Min Step Size", 1.0e-4);
751 stepSizeList.set(
"Max Step Size", 1.0);
752 stepSizeList.set(
"Aggressiveness", 1.0);
758 if (!usedOP && !usedNODESET)
766 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
769 if (locaStatus != LOCA::Abstract::Iterator::Finished)
781 stepperList.set(
"Continuation Parameter", nonlinear);
783 stepperList.set(
"Initial Value", 0.0);
784 stepperList.set(
"Max Value", 1.0);
785 stepperList.set(
"Min Value",-1.0);
787 stepSizeList.set(
"Initial Step Size", 0.2);
788 stepSizeList.set(
"Min Step Size", 1.0e-4);
789 stepSizeList.set(
"Max Step Size", 1.0);
790 stepSizeList.set(
"Aggressiveness", 1.0);
795 locaPVec.setValue(gain, 1.0);
796 locaPVec.setValue(nonlinear, 0.0);
806 groupPtr_->setAugmentLinearSystem(
false, alsNull);
810 if (locaStatus != LOCA::Abstract::Iterator::Finished)
829 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
832 std::string gain =
"mosfet:gainscale";
833 std::string nonlinear =
"mosfet:nltermscale";
834 std::string size =
"mosfet:sizescale";
837 LOCA::ParameterVector locaPVec;
838 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
843 locaPVec.addParameter(gain, 0.0);
844 locaPVec.addParameter(nonlinear, 0.0);
845 locaPVec.addParameter(size, 0.0);
847 stepperList.set(
"Continuation Parameter", gain);
848 stepperList.set(
"Initial Value", 0.0);
849 stepperList.set(
"Max Value", 1.0);
856 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
859 if (locaStatus != LOCA::Abstract::Iterator::Finished)
872 stepperList.set(
"Continuation Parameter", nonlinear);
873 stepperList.set(
"Initial Value", 0.0);
874 stepperList.set(
"Max Value", 1.0);
875 locaPVec.setValue(gain, 1.0);
876 locaPVec.setValue(nonlinear, 0.0);
877 locaPVec.setValue(size, 0.0);
885 if (locaStatus != LOCA::Abstract::Iterator::Finished)
894 stepperList.set(
"Continuation Parameter", size);
895 stepperList.set(
"Initial Value", 0.0);
896 stepperList.set(
"Max Value", 1.0);
897 locaPVec.setValue(gain, 1.0);
898 locaPVec.setValue(nonlinear, 1.0);
899 locaPVec.setValue(size, 0.0);
907 if (locaStatus != LOCA::Abstract::Iterator::Finished)
925 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
929 std::string nonlinear =
"mosfet:nltermscale";
930 std::string size =
"mosfet:sizescale";
933 LOCA::ParameterVector locaPVec;
934 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
940 locaPVec.addParameter(nonlinear, 0.0);
941 locaPVec.addParameter(size, 0.0);
943 stepperList.set(
"Continuation Parameter", nonlinear);
944 stepperList.set(
"Initial Value", 0.0);
945 stepperList.set(
"Max Value", 1.0);
952 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
955 if (locaStatus != LOCA::Abstract::Iterator::Finished)
968 stepperList.set(
"Continuation Parameter", size);
969 stepperList.set(
"Initial Value", 0.0);
970 stepperList.set(
"Max Value", 1.0);
972 locaPVec.setValue(nonlinear, 1.0);
973 locaPVec.setValue(size, 0.0);
981 if (locaStatus != LOCA::Abstract::Iterator::Finished)
999 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1002 std::string gain =
"mosfet:gainscale";
1003 std::string nonlinear =
"mosfet:nltermscale";
1004 std::string size =
"mosfet:sizescale";
1007 LOCA::ParameterVector locaPVec;
1008 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1011 locaPVec.addParameter(gain, 1.0);
1012 locaPVec.addParameter(nonlinear, 1.0);
1013 locaPVec.addParameter(size, 0.0);
1015 stepperList.set(
"Continuation Parameter", size);
1016 stepperList.set(
"Initial Value", 0.0);
1017 stepperList.set(
"Max Value", 1.0);
1024 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1027 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1050 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1051 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1052 LOCA::ParameterVector locaPVec;
1055 int numHomotopyContinuationRuns = 1;
1056 std::vector<std::string> names(numHomotopyContinuationRuns);
1057 std::vector<double> initialVal(numHomotopyContinuationRuns);
1058 std::vector<double> finalVal(numHomotopyContinuationRuns);
1059 std::vector<double> minVal(numHomotopyContinuationRuns);
1060 std::vector<double> maxVal(numHomotopyContinuationRuns);
1066 names[0] =
"mosfet:gainscale";
1070 initialVal[0] = 0.0;
1077 std::string n1 =
"mosfet:nltermscale";
1078 locaPVec.addParameter(n1, 0.0);
1085 for (
int i = 0; i < names.size(); ++i) {
1086 if (finalVal[i] > initialVal[i]) {
1087 minVal[i] = initialVal[i];
1088 maxVal[i] = finalVal[i];
1091 minVal[i] = finalVal[i];
1092 maxVal[i] = initialVal[i];
1097 for (
int i = 0; i < names.size(); ++i)
1098 locaPVec.addParameter(names[i], initialVal[i]);
1100 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1105 for (
int hs = 0; hs < names.size(); ++hs) {
1106 for (
int i = 0; i < names.size(); ++i) {
1108 locaPVec.setValue(names[i], initialVal[i]);
1110 locaPVec.setValue(names[i], finalVal[i]);
1113 stepperList.set(
"Continuation Parameter", names[hs]);
1114 stepperList.set(
"Initial Value", initialVal[hs]);
1115 stepperList.set(
"Min Value", minVal[hs]);
1116 stepperList.set(
"Max Value", maxVal[hs]);
1126 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1154 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1155 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1156 LOCA::ParameterVector locaPVec;
1159 int numHomotopyContinuationRuns = 4;
1160 std::vector<std::string> names(numHomotopyContinuationRuns);
1161 std::vector<double> initialVal(numHomotopyContinuationRuns);
1162 std::vector<double> finalVal(numHomotopyContinuationRuns);
1163 std::vector<double> minVal(numHomotopyContinuationRuns);
1164 std::vector<double> maxVal(numHomotopyContinuationRuns);
1170 names[0] = stepperList.get(
"Power Node",
"VA:V0");
1171 names[1] =
"mosfet:gainscale";
1172 names[2] =
"mosfet:nltermscale";
1173 names[3] =
"mosfet:sizescale";
1174 initialVal[0] = 0.0;
1175 initialVal[1] = 0.0;
1176 initialVal[2] = 0.0;
1177 initialVal[3] = 0.0;
1191 for (
int i = 0; i < names.size(); ++i) {
1192 if (finalVal[i] > initialVal[i]) {
1193 minVal[i] = initialVal[i];
1194 maxVal[i] = finalVal[i];
1197 minVal[i] = finalVal[i];
1198 maxVal[i] = initialVal[i];
1203 for (
int i = 0; i < names.size(); ++i)
1204 locaPVec.addParameter(names[i], initialVal[i]);
1206 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1209 for (
int hs = 0; hs < names.size(); ++hs) {
1210 for (
int i = 0; i < names.size(); ++i) {
1212 locaPVec.setValue(names[i], initialVal[i]);
1214 locaPVec.setValue(names[i], finalVal[i]);
1217 stepperList.set(
"Continuation Parameter", names[hs]);
1218 stepperList.set(
"Initial Value", initialVal[hs]);
1219 stepperList.set(
"Min Value", minVal[hs]);
1220 stepperList.set(
"Max Value", maxVal[hs]);
1230 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1256 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1257 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1258 LOCA::ParameterVector locaPVec;
1261 int numGainBlocks =
loaderPtr_->getHomotopyBlockSize();
1262 int numHomotopyContinuationRuns = 1 + numGainBlocks;
1263 std::vector<std::string> names(numHomotopyContinuationRuns);
1264 std::vector<double> initialVal(numHomotopyContinuationRuns);
1265 std::vector<double> finalVal(numHomotopyContinuationRuns);
1266 std::vector<double> minVal(numHomotopyContinuationRuns);
1267 std::vector<double> maxVal(numHomotopyContinuationRuns);
1273 for (
int i = 0; i < numGainBlocks; ++i) {
1274 std::stringstream s;
1276 names[i] =
"mosfet:gainscale_block_" + s.str();
1277 initialVal[i] = 0.0;
1280 names[numHomotopyContinuationRuns - 1] =
"mosfet:nltermscale";
1281 initialVal[numHomotopyContinuationRuns - 1] = 0.0;
1282 finalVal[numHomotopyContinuationRuns - 1] = 1.0;
1287 for (
int i = 0; i < names.size(); ++i) {
1288 if (finalVal[i] > initialVal[i]) {
1289 minVal[i] = initialVal[i];
1290 maxVal[i] = finalVal[i];
1293 minVal[i] = finalVal[i];
1294 maxVal[i] = initialVal[i];
1299 for (
int i = 0; i < names.size(); ++i)
1300 locaPVec.addParameter(names[i], initialVal[i]);
1302 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1305 for (
int hs = 0; hs < names.size(); ++hs) {
1306 for (
int i = 0; i < names.size(); ++i) {
1308 locaPVec.setValue(names[i], initialVal[i]);
1310 locaPVec.setValue(names[i], finalVal[i]);
1313 stepperList.set(
"Continuation Parameter", names[hs]);
1314 stepperList.set(
"Initial Value", initialVal[hs]);
1315 stepperList.set(
"Min Value", minVal[hs]);
1316 stepperList.set(
"Max Value", maxVal[hs]);
1326 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1353 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1356 std::string gmin =
"GSTEPPING";
1359 LOCA::ParameterVector locaPVec;
1360 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1361 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
1362 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1365 locaPVec.addParameter(gmin, 0.0);
1367 stepperList.set(
"Continuation Parameter", gmin);
1368 stepperList.set(
"Continuation Method",
"Natural");
1370 stepSizeList.set(
"Method",
"Adaptive");
1371 predictorList.set(
"Method",
"Constant");
1373 stepperList.set(
"Initial Value", 4.0);
1374 stepperList.set(
"Min Value", -4.0);
1376 stepperList.set(
"Max Value", 4.0);
1378 stepSizeList.set(
"Initial Step Size", -2.0);
1379 stepSizeList.set(
"Min Step Size", 1.0e-6);
1380 stepSizeList.set(
"Max Step Size", 1.0e+12);
1381 stepSizeList.set(
"Aggressiveness", 0.01);
1383 stepperList.set(
"Max Steps", 400);
1384 stepperList.set(
"Max Nonlinear Iterations", 20);
1391 bool usedNODESET=
false;
1393 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
1412 if (!usedOP && !usedNODESET)
1421 std::string message =
"'.dcop input=' and gstepping are incompatible";
1422 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
1426 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1428 groupPtr_->setAugmentLinearSystem(
true, als);
1433 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1435 groupPtr_->setAugmentLinearSystem(
false, alsNull);
1438 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1456 Teuchos::RefCountPtr<NOX::StatusTest::Combo> ctest =
1457 Teuchos::rcp(
new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR));
1459 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList =
1461 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1462 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1463 double initialStepSize =
1464 stepSizeList.get(
"Initial Step Size", 1.0e-3);
1465 double minStepSize = stepSizeList.get(
"Min Step Size", 1.0e-12);
1466 double maxStepSize = stepSizeList.get(
"Max Step Size", 1.0e4);
1467 Teuchos::RefCountPtr<Teuchos::ParameterList> noxList =
1472 Teuchos::RefCountPtr<NOX::StatusTest::MaxIters> mi =
1473 Teuchos::rcp(
new NOX::StatusTest::MaxIters(stepperList.get(
"Max Steps", 200)));
1474 Teuchos::RefCountPtr<NOX::StatusTest::FiniteValue> fv =
1475 Teuchos::rcp(
new NOX::StatusTest::FiniteValue);
1476 Teuchos::RefCountPtr<N_NLS_NOX::PseudoTransientTest> pt =
1479 ctest->addStatusTest(mi);
1480 ctest->addStatusTest(fv);
1481 ctest->addStatusTest(pt);
1485 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1496 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1507 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> dummy;
1508 groupPtr_->setAugmentLinearSystem(
false, dummy);
1532 #ifdef Xyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT
1533 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1534 Teuchos::ParameterList& locaUtilsList = locaList->sublist(
"Utilities");
1536 Teuchos::RefCountPtr<LOCA::Homotopy::Group> hGrp =
1541 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1542 locaList->sublist(
"Stepper").set(
"Max Value", 0.999);
1546 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1549 Teuchos::RefCountPtr<LOCA::Homotopy::Group> hGrp2 =
1552 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1553 locaList->sublist(
"Stepper").set(
"Initial Value", 0.999);
1554 locaList->sublist(
"Stepper").set(
"Max Value", 1.0);
1555 locaList->sublist(
"Step Size").set(
"Method",
"Constant");
1556 locaList->sublist(
"Step Size").set(
"Initial Step Size", 0.0001);
1557 locaList->sublist(
"Step Size").set(
"Min Step Size", 0.0001);
1564 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1570 Xyce::Report::UserFatal0() <<
"Nonlinear Solver (NOX::Interface) Artificial parameter continuation requires "
1571 <<
"building xyce with the define: -DXyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT to "
1572 <<
"allow LOCA to augment the diagonal of Jacobian! Either rebuild Xyce or do not "
1573 <<
"run Xyce with \"continuation=33\"";
1603 #ifdef Xyce_DEBUG_NONLINEAR
1604 N_NLS_NonLinearSolver::setDebugFlags ();
1714 groupPtr_->setNonContinuationFlag (
true);
1718 groupPtr_->setNonContinuationFlag (
false);
1721 #ifdef Xyce_DEBUG_NONLINEAR
1722 Xyce::dout() <<
"solverType is " << solverType << std::endl;
1727 if (solverType == 0)
1732 else if (solverType == 1)
1737 else if (solverType == 2)
1741 else if (solverType == 3)
1746 else if (solverType == 4)
1751 else if (solverType == 5)
1756 else if (solverType == 6)
1760 else if (solverType == 7)
1764 else if (solverType == 8)
1768 else if (solverType == 9)
1772 else if (solverType == 10)
1776 else if (solverType == 33)
1782 catch (
const char* error_msg) {
1783 std::string nox_error =
"NOX Error";
1784 std::string err_msg = std::string(error_msg);
1785 if (err_msg == nox_error) {
1786 const std::string message =
1787 "Caught a NOX Exception in N_NLS_NOX::Interface::solve()!";
1788 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1794 catch (
const std::exception& e) {
1795 Xyce::dout() << e.what() << std::endl;
1796 const std::string message =
1797 "Caught std::exception in N_NLS_NOX::Interface::solve()!";
1798 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1801 const std::string message =
1802 "Caught Unknown Exception in N_NLS_NOX::Interface::solve()!";
1803 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1829 #ifdef Xyce_DEBUG_OP_START
1830 Xyce::dout() <<
"NOX_Interface: Inside continuation=0 OP_START code (case 1)" << std::endl;
1836 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1837 const Xyce::NodeNamePairMap & allNodes =
outMgrPtr_->getAllNodes( );
1838 #ifdef Xyce_PARALLEL_MPI
1839 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1842 if (found > 0 && icType == Xyce::IO::InitialConditionsData::IC_TYPE_DCOP_RESTART)
1846 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1847 #ifdef Xyce_PARALLEL_MPI
1852 groupPtr_->setAugmentLinearSystem(
true, als);
1853 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1859 groupPtr_->setAugmentLinearSystem(
false, als);
1862 #ifdef Xyce_DEBUG_OP_START
1864 #ifdef Xyce_PARALLEL_MPI
1865 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
1867 groupPtr_->setOutputLinear (&op, &allNodes);
1869 #endif // debug op start
1893 #ifdef Xyce_DEBUG_OP_START
1894 Xyce::dout() <<
"NOX_Interface: Inside continuation=1 OP_START code (case 2)" << std::endl;
1900 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1901 const Xyce::NodeNamePairMap & allNodes =
outMgrPtr_->getAllNodes( );
1902 #ifdef Xyce_PARALLEL_MPI
1903 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1906 if (found > 0 && icType == Xyce::IO::InitialConditionsData::IC_TYPE_DCOP_RESTART)
1918 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1919 #ifdef Xyce_PARALLEL_MPI
1924 groupPtr_->setAugmentLinearSystem(
true, als);
1925 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1928 groupPtr_->setAugmentLinearSystem(
false, als);
1931 #ifdef Xyce_DEBUG_OP_START
1933 #ifdef Xyce_PARALLEL_MPI
1934 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
1936 groupPtr_->setOutputLinear (&op, &allNodes);
1938 #endif // debug op start
1962 #ifdef Xyce_DEBUG_IC
1963 Xyce::dout() <<
"NOX_Interface: Inside continuation=0 .IC code." << std::endl;
1967 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1969 usedIC = (icType==Xyce::IO::InitialConditionsData::IC_TYPE_IC && found > 0);
1972 bool useGminStepping=
false;
1973 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1975 groupPtr_->setAugmentLinearSystem(
true, als);
1997 #ifdef Xyce_DEBUG_IC
1998 Xyce::dout() <<
"NOX_Interface: Inside continuation=3 .IC code." << std::endl;
2002 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
2004 usedIC = (icType==Xyce::IO::InitialConditionsData::IC_TYPE_IC && found > 0);
2007 bool useGminStepping=
true;
2008 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
2010 groupPtr_->setAugmentLinearSystem(
true, als);
2025 bool usedNODESET(
false);
2027 #ifdef Xyce_DEBUG_IC
2028 Xyce::dout() <<
"NOX_Interface: Inside continuation=0 .NODESET code (case 1)" << std::endl;
2032 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
2033 #ifdef Xyce_PARALLEL_MPI
2034 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
2037 usedNODESET = (icType==Xyce::IO::InitialConditionsData::IC_TYPE_NODESET && found > 0);
2040 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
2043 groupPtr_->setAugmentLinearSystem(
true, als);
2044 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2051 groupPtr_->setAugmentLinearSystem(
false, als);
2068 bool usedNODESET(
false);
2070 #ifdef Xyce_DEBUG_IC
2071 Xyce::dout() <<
"NOX_Interface: Inside continuation=1 .NODESET code (case 2)" << std::endl;
2076 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
2077 #ifdef Xyce_PARALLEL_MPI
2078 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
2081 usedNODESET = (icType==Xyce::IO::InitialConditionsData::IC_TYPE_NODESET && found > 0);
2092 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
2095 groupPtr_->setAugmentLinearSystem(
true, als);
2096 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2099 groupPtr_->setAugmentLinearSystem(
false, als);
2151 Xyce::dout() <<
"takeFirstSolveStep: allocating a new group!" << std::endl;
2160 Xyce::dout() <<
"takeFirstSolveStep: using the old group!" << std::endl;
2167 Xyce::dout() <<
"takeFirstSolveStep: copying over the passed group!" << std::endl;
2182 NOX::StatusTest::StatusType status =
solverPtr_->step();
2185 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2200 NOX::StatusTest::StatusType status =
solverPtr_->step();
2203 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2228 if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 0))
2230 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 1))
2232 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 9))
2234 else if ((!Teuchos::is_null(
stepperPtr_)) && (solverType != 0))
2236 return stepperPtr_->getSolver()->getNumIterations();
2302 return maxNormFindex;
2633 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2637 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2721 const Teuchos::RefCountPtr<LOCA::MultiContinuation::AbstractGroup>& initialGuess,
2722 const Teuchos::RefCountPtr<NOX::StatusTest::Generic>& test,
2723 const Teuchos::RefCountPtr<Teuchos::ParameterList>& p)
2726 Teuchos::rcp(
new LOCA::Stepper(gd, initialGuess, test, p));
2749 if (solverType != 0) retCode =
true;
2770 if (solverType != 0) retCode =
true;