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"
81 #ifdef Xyce_PARALLEL_MPI
82 #include <N_PDS_ParComm.h>
84 #include <N_PDS_SerialComm.h>
92 using namespace N_NLS_NOX;
109 lastParametersMode_(
DC_OP),
110 parametersMode_(
DC_OP),
112 copiedGroupFlag_(false),
115 NODESETspecified_(false),
116 isFirstContinuationParam_(true),
117 firstSolveComplete_(false),
285 int myPID =
pdsMgrPtr_->getPDSComm()->procID();
290 std::vector<char> varTypeVec;
297 #ifdef Xyce_NLS_MASKED_WRMS_NORMS
320 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
326 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
332 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
367 #ifdef Xyce_DEBUG_NONLINEAR
368 N_NLS_NonLinearSolver::setDebugFlags ();
468 groupPtr_->setNonContinuationFlag (
true);
472 groupPtr_->setNonContinuationFlag (
false);
475 #ifdef Xyce_DEBUG_NONLINEAR
476 Xyce::dout() <<
"solverType is " << solverType << std::endl;
484 bool usedNODESET=
false;
498 #ifdef Xyce_DEBUG_NONLINEAR
499 Xyce::dout() <<
"Creating new NLS solver b/c it is 0." <<std::endl;
511 usedIC=
icCont (paramsPtr);
525 #ifdef Xyce_DEBUG_NONLINEAR
526 Xyce::dout() <<
"Creating new NLS solver b/c starting next phase, post-DC." <<std::endl;
535 #ifdef Xyce_DEBUG_NONLINEAR
536 Xyce::dout() <<
"NOT Creating new NLS solver, just resetting." <<std::endl;
541 NOX::StatusTest::StatusType status =
solverPtr_->solve();
546 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
547 groupPtr_->setAugmentLinearSystem(
false, alsNull);
550 #ifdef Xyce_DEBUG_NONLINEAR
558 else if (solverType == 1)
560 std::vector<std::string> pars;
565 bool usedNODESET=
false;
572 usedIC=
icCont (paramsPtr);
584 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList =
588 LOCA::ParameterVector locaPVec;
589 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
590 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
599 if ( numParam == 0 ) {
600 std::string message =
"Using \"continuation=1\" requires a parameter to be set with the conparam keyword in the loca option block!";
601 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
604 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als;
605 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
607 std::vector<double> minValue(numParam, 0.);
608 std::vector<double> maxValue(numParam, 0.);
609 std::vector<double> initialValue(numParam, 0.);
610 std::vector<double> initialStepSize(numParam, 0.);
611 std::vector<double> minStepSize(numParam, 0.);
612 std::vector<double> maxStepSize(numParam, 0.);
613 std::vector<double> aggressiveness(numParam, 0.);
616 std::vector<std::string> paramNames(0);
617 paramNames.push_back(
"MINVALUE");
618 paramNames.push_back(
"MAXVALUE");
619 paramNames.push_back(
"INITIALVALUE");
620 paramNames.push_back(
"INITIALSTEPSIZE");
621 paramNames.push_back(
"MINSTEPSIZE");
622 paramNames.push_back(
"MAXSTEPSIZE");
623 paramNames.push_back(
"AGGRESSIVENESS");
625 for (std::size_t p = 0 ; p < paramNames.size() ; ++p) {
627 std::string msg =
"The parameter \"" +
629 "\" must have a list of values with size equal to the numParamber of parameters specified in \"conparam\".";
630 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
657 locaPVec.addParameter (pars[
iParam_], initialValue[iParam_]);
661 if (usedOP || usedNODESET)
671 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
681 stepperList.set(
"Continuation Parameter", pars[
iParam_]);
682 stepperList.set(
"Initial Value", initialValue[iParam_]);
683 stepperList.set(
"Max Value", maxValue[iParam_]);
684 stepperList.set(
"Min Value", minValue[iParam_]);
685 stepSizeList.set(
"Initial Step Size", initialStepSize[iParam_]);
686 stepSizeList.set(
"Min Step Size", minStepSize[iParam_]);
687 stepSizeList.set(
"Max Step Size", maxStepSize[iParam_]);
688 stepSizeList.set(
"Aggressiveness", aggressiveness[iParam_]);
692 locaPVec.setValue(pars[j], maxValue[j]);
694 for (j=iParam_ ; j<numParam ; ++j)
696 locaPVec.setValue(pars[j], initialValue[j]);
702 if (!usedOP && !usedNODESET)
712 if (pars[iParam_] !=
"GSTEPPING")
717 if (usedIC || usedNODESET)
719 groupPtr_->setAugmentLinearSystem(
false, alsNull);
726 std::string message =
"'.dcop input=' and gstepping are incompatible";
727 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
729 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
731 groupPtr_->setAugmentLinearSystem(
true, als);
737 groupPtr_->setAugmentLinearSystem(
false, alsNull);
741 if (locaStatus != LOCA::Abstract::Iterator::Finished)
751 else if (solverType == 2)
754 bool usedNODESET=
false;
756 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
762 usedIC=
icCont (paramsPtr);
775 std::vector<std::string> pars;
784 if ( numParam > 1 ) {
785 std::string message =
"WARNING: Using \"continuation=2\" currently does not support vectorized loca parameters. Only the first values in each list will be used.";
786 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING, message);
789 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
792 std::string gain =
"mosfet:gainscale";
793 std::string nonlinear =
"mosfet:nltermscale";
796 LOCA::ParameterVector locaPVec;
797 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
798 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
799 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
803 locaPVec.addParameter(gain, 0.0);
804 locaPVec.addParameter(nonlinear, 0.0);
806 stepperList.set(
"Continuation Parameter", gain);
808 stepperList.set(
"Initial Value", 0.0);
809 stepperList.set(
"Max Value", 1.0);
810 stepperList.set(
"Min Value",-1.0);
812 stepSizeList.set(
"Initial Step Size", 0.2);
813 stepSizeList.set(
"Min Step Size", 1.0e-4);
814 stepSizeList.set(
"Max Step Size", 1.0);
815 stepSizeList.set(
"Aggressiveness", 1.0);
821 if (!usedOP && !usedNODESET)
829 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
832 if (locaStatus != LOCA::Abstract::Iterator::Finished)
844 stepperList.set(
"Continuation Parameter", nonlinear);
846 stepperList.set(
"Initial Value", 0.0);
847 stepperList.set(
"Max Value", 1.0);
848 stepperList.set(
"Min Value",-1.0);
850 stepSizeList.set(
"Initial Step Size", 0.2);
851 stepSizeList.set(
"Min Step Size", 1.0e-4);
852 stepSizeList.set(
"Max Step Size", 1.0);
853 stepSizeList.set(
"Aggressiveness", 1.0);
858 locaPVec.setValue(gain, 1.0);
859 locaPVec.setValue(nonlinear, 0.0);
869 groupPtr_->setAugmentLinearSystem(
false, alsNull);
873 if (locaStatus != LOCA::Abstract::Iterator::Finished)
879 else if (solverType == 3)
883 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
886 std::string gmin =
"GSTEPPING";
889 LOCA::ParameterVector locaPVec;
890 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
891 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
892 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
895 locaPVec.addParameter(gmin, 0.0);
897 stepperList.set(
"Continuation Parameter", gmin);
898 stepperList.set(
"Continuation Method",
"Natural");
900 stepSizeList.set(
"Method",
"Adaptive");
901 predictorList.set(
"Method",
"Constant");
903 stepperList.set(
"Initial Value", 4.0);
904 stepperList.set(
"Min Value", -4.0);
906 stepperList.set(
"Max Value", 4.0);
908 stepSizeList.set(
"Initial Step Size", -2.0);
909 stepSizeList.set(
"Min Step Size", 1.0e-6);
910 stepSizeList.set(
"Max Step Size", 1.0e+12);
911 stepSizeList.set(
"Aggressiveness", 0.01);
913 stepperList.set(
"Max Steps", 400);
914 stepperList.set(
"Max Nonlinear Iterations", 20);
921 bool usedNODESET=
false;
923 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> alsNull;
942 if (!usedOP && !usedNODESET)
951 std::string message =
"'.dcop input=' and gstepping are incompatible";
952 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
956 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
958 groupPtr_->setAugmentLinearSystem(
true, als);
963 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
965 groupPtr_->setAugmentLinearSystem(
false, alsNull);
968 if (locaStatus != LOCA::Abstract::Iterator::Finished)
974 else if (solverType == 4)
977 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
980 std::string gain =
"mosfet:gainscale";
981 std::string nonlinear =
"mosfet:nltermscale";
982 std::string size =
"mosfet:sizescale";
985 LOCA::ParameterVector locaPVec;
986 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
991 locaPVec.addParameter(gain, 0.0);
992 locaPVec.addParameter(nonlinear, 0.0);
993 locaPVec.addParameter(size, 0.0);
995 stepperList.set(
"Continuation Parameter", gain);
996 stepperList.set(
"Initial Value", 0.0);
997 stepperList.set(
"Max Value", 1.0);
1004 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1007 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1020 stepperList.set(
"Continuation Parameter", nonlinear);
1021 stepperList.set(
"Initial Value", 0.0);
1022 stepperList.set(
"Max Value", 1.0);
1023 locaPVec.setValue(gain, 1.0);
1024 locaPVec.setValue(nonlinear, 0.0);
1025 locaPVec.setValue(size, 0.0);
1033 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1042 stepperList.set(
"Continuation Parameter", size);
1043 stepperList.set(
"Initial Value", 0.0);
1044 stepperList.set(
"Max Value", 1.0);
1045 locaPVec.setValue(gain, 1.0);
1046 locaPVec.setValue(nonlinear, 1.0);
1047 locaPVec.setValue(size, 0.0);
1055 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1062 else if (solverType == 5)
1065 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1069 std::string nonlinear =
"mosfet:nltermscale";
1070 std::string size =
"mosfet:sizescale";
1073 LOCA::ParameterVector locaPVec;
1074 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1080 locaPVec.addParameter(nonlinear, 0.0);
1081 locaPVec.addParameter(size, 0.0);
1083 stepperList.set(
"Continuation Parameter", nonlinear);
1084 stepperList.set(
"Initial Value", 0.0);
1085 stepperList.set(
"Max Value", 1.0);
1092 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1095 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1108 stepperList.set(
"Continuation Parameter", size);
1109 stepperList.set(
"Initial Value", 0.0);
1110 stepperList.set(
"Max Value", 1.0);
1112 locaPVec.setValue(nonlinear, 1.0);
1113 locaPVec.setValue(size, 0.0);
1121 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1128 else if (solverType == 6)
1131 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1134 std::string gain =
"mosfet:gainscale";
1135 std::string nonlinear =
"mosfet:nltermscale";
1136 std::string size =
"mosfet:sizescale";
1139 LOCA::ParameterVector locaPVec;
1140 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1143 locaPVec.addParameter(gain, 1.0);
1144 locaPVec.addParameter(nonlinear, 1.0);
1145 locaPVec.addParameter(size, 0.0);
1147 stepperList.set(
"Continuation Parameter", size);
1148 stepperList.set(
"Initial Value", 0.0);
1149 stepperList.set(
"Max Value", 1.0);
1156 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1159 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1168 else if (solverType == 7)
1172 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1173 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1174 LOCA::ParameterVector locaPVec;
1177 int numGainBlocks =
loaderPtr_->getHomotopyBlockSize();
1178 int numHomotopyContinuationRuns = 1 + numGainBlocks;
1179 std::vector<std::string> names(numHomotopyContinuationRuns);
1180 std::vector<double> initialVal(numHomotopyContinuationRuns);
1181 std::vector<double> finalVal(numHomotopyContinuationRuns);
1182 std::vector<double> minVal(numHomotopyContinuationRuns);
1183 std::vector<double> maxVal(numHomotopyContinuationRuns);
1189 for (
int i = 0; i < numGainBlocks; ++i) {
1190 std::stringstream s;
1192 names[i] =
"mosfet:gainscale_block_" + s.str();
1193 initialVal[i] = 0.0;
1196 names[numHomotopyContinuationRuns - 1] =
"mosfet:nltermscale";
1197 initialVal[numHomotopyContinuationRuns - 1] = 0.0;
1198 finalVal[numHomotopyContinuationRuns - 1] = 1.0;
1203 for (
int i = 0; i < names.size(); ++i) {
1204 if (finalVal[i] > initialVal[i]) {
1205 minVal[i] = initialVal[i];
1206 maxVal[i] = finalVal[i];
1209 minVal[i] = finalVal[i];
1210 maxVal[i] = initialVal[i];
1215 for (
int i = 0; i < names.size(); ++i)
1216 locaPVec.addParameter(names[i], initialVal[i]);
1218 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1221 for (
int hs = 0; hs < names.size(); ++hs) {
1222 for (
int i = 0; i < names.size(); ++i) {
1224 locaPVec.setValue(names[i], initialVal[i]);
1226 locaPVec.setValue(names[i], finalVal[i]);
1229 stepperList.set(
"Continuation Parameter", names[hs]);
1230 stepperList.set(
"Initial Value", initialVal[hs]);
1231 stepperList.set(
"Min Value", minVal[hs]);
1232 stepperList.set(
"Max Value", maxVal[hs]);
1242 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1257 else if (solverType == 8)
1261 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1262 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1263 LOCA::ParameterVector locaPVec;
1266 int numHomotopyContinuationRuns = 1;
1267 std::vector<std::string> names(numHomotopyContinuationRuns);
1268 std::vector<double> initialVal(numHomotopyContinuationRuns);
1269 std::vector<double> finalVal(numHomotopyContinuationRuns);
1270 std::vector<double> minVal(numHomotopyContinuationRuns);
1271 std::vector<double> maxVal(numHomotopyContinuationRuns);
1277 names[0] =
"mosfet:gainscale";
1281 initialVal[0] = 0.0;
1288 std::string n1 =
"mosfet:nltermscale";
1289 locaPVec.addParameter(n1, 0.0);
1296 for (
int i = 0; i < names.size(); ++i) {
1297 if (finalVal[i] > initialVal[i]) {
1298 minVal[i] = initialVal[i];
1299 maxVal[i] = finalVal[i];
1302 minVal[i] = finalVal[i];
1303 maxVal[i] = initialVal[i];
1308 for (
int i = 0; i < names.size(); ++i)
1309 locaPVec.addParameter(names[i], initialVal[i]);
1311 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1316 for (
int hs = 0; hs < names.size(); ++hs) {
1317 for (
int i = 0; i < names.size(); ++i) {
1319 locaPVec.setValue(names[i], initialVal[i]);
1321 locaPVec.setValue(names[i], finalVal[i]);
1324 stepperList.set(
"Continuation Parameter", names[hs]);
1325 stepperList.set(
"Initial Value", initialVal[hs]);
1326 stepperList.set(
"Min Value", minVal[hs]);
1327 stepperList.set(
"Max Value", maxVal[hs]);
1337 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1352 else if (solverType == 9)
1354 Teuchos::RefCountPtr<NOX::StatusTest::Combo> ctest =
1355 Teuchos::rcp(
new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR));
1357 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList =
1359 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1360 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1361 double initialStepSize =
1362 stepSizeList.get(
"Initial Step Size", 1.0e-3);
1363 double minStepSize = stepSizeList.get(
"Min Step Size", 1.0e-12);
1364 double maxStepSize = stepSizeList.get(
"Max Step Size", 1.0e4);
1365 Teuchos::RefCountPtr<Teuchos::ParameterList> noxList =
1370 Teuchos::RefCountPtr<NOX::StatusTest::MaxIters> mi =
1371 Teuchos::rcp(
new NOX::StatusTest::MaxIters(stepperList.get(
"Max Steps", 200)));
1372 Teuchos::RefCountPtr<NOX::StatusTest::FiniteValue> fv =
1373 Teuchos::rcp(
new NOX::StatusTest::FiniteValue);
1374 Teuchos::RefCountPtr<N_NLS_NOX::PseudoTransientTest> pt =
1377 ctest->addStatusTest(mi);
1378 ctest->addStatusTest(fv);
1379 ctest->addStatusTest(pt);
1383 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1394 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1405 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> dummy;
1406 groupPtr_->setAugmentLinearSystem(
false, dummy);
1417 else if (solverType == 10)
1421 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1422 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1423 LOCA::ParameterVector locaPVec;
1426 int numHomotopyContinuationRuns = 4;
1427 std::vector<std::string> names(numHomotopyContinuationRuns);
1428 std::vector<double> initialVal(numHomotopyContinuationRuns);
1429 std::vector<double> finalVal(numHomotopyContinuationRuns);
1430 std::vector<double> minVal(numHomotopyContinuationRuns);
1431 std::vector<double> maxVal(numHomotopyContinuationRuns);
1437 names[0] = stepperList.get(
"Power Node",
"VA:V0");
1438 names[1] =
"mosfet:gainscale";
1439 names[2] =
"mosfet:nltermscale";
1440 names[3] =
"mosfet:sizescale";
1441 initialVal[0] = 0.0;
1442 initialVal[1] = 0.0;
1443 initialVal[2] = 0.0;
1444 initialVal[3] = 0.0;
1458 for (
int i = 0; i < names.size(); ++i) {
1459 if (finalVal[i] > initialVal[i]) {
1460 minVal[i] = initialVal[i];
1461 maxVal[i] = finalVal[i];
1464 minVal[i] = finalVal[i];
1465 maxVal[i] = initialVal[i];
1470 for (
int i = 0; i < names.size(); ++i)
1471 locaPVec.addParameter(names[i], initialVal[i]);
1473 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1476 for (
int hs = 0; hs < names.size(); ++hs) {
1477 for (
int i = 0; i < names.size(); ++i) {
1479 locaPVec.setValue(names[i], initialVal[i]);
1481 locaPVec.setValue(names[i], finalVal[i]);
1484 stepperList.set(
"Continuation Parameter", names[hs]);
1485 stepperList.set(
"Initial Value", initialVal[hs]);
1486 stepperList.set(
"Min Value", minVal[hs]);
1487 stepperList.set(
"Max Value", maxVal[hs]);
1497 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1510 else if (solverType == 33)
1513 #ifdef Xyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT
1514 Teuchos::RefCountPtr<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1515 Teuchos::ParameterList& locaUtilsList = locaList->sublist(
"Utilities");
1517 Teuchos::RefCountPtr<LOCA::Homotopy::Group> hGrp =
1522 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1523 locaList->sublist(
"Stepper").set(
"Max Value", 0.999);
1527 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1530 Teuchos::RefCountPtr<LOCA::Homotopy::Group> hGrp2 =
1533 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1534 locaList->sublist(
"Stepper").set(
"Initial Value", 0.999);
1535 locaList->sublist(
"Stepper").set(
"Max Value", 1.0);
1536 locaList->sublist(
"Step Size").set(
"Method",
"Constant");
1537 locaList->sublist(
"Step Size").set(
"Initial Step Size", 0.0001);
1538 locaList->sublist(
"Step Size").set(
"Min Step Size", 0.0001);
1545 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1551 Xyce::Report::UserFatal0() <<
"Nonlinear Solver (NOX::Interface) Artificial parameter continuation requires "
1552 <<
"building xyce with the define: -DXyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT to "
1553 <<
"allow LOCA to augment the diagonal of Jacobian! Either rebuild Xyce or do not "
1554 <<
"run Xyce with \"continuation=33\"";
1559 catch (
const char* error_msg) {
1560 std::string nox_error =
"NOX Error";
1561 std::string err_msg = std::string(error_msg);
1562 if (err_msg == nox_error) {
1563 const std::string message =
1564 "Caught a NOX Exception in N_NLS_NOX::Interface::solve()!";
1565 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1571 catch (
const std::exception& e) {
1572 Xyce::dout() << e.what() << std::endl;
1573 const std::string message =
1574 "Caught std::exception in N_NLS_NOX::Interface::solve()!";
1575 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1578 const std::string message =
1579 "Caught Unknown Exception in N_NLS_NOX::Interface::solve()!";
1580 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1606 #ifdef Xyce_DEBUG_OP_START
1607 Xyce::dout() <<
"NOX_Interface: Inside continuation=0 OP_START code (case 1)" << std::endl;
1613 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1614 Xyce::NodeNamePairMap & allNodes =
outMgrPtr_->getAllNodes( );
1615 #ifdef Xyce_PARALLEL_MPI
1616 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1619 if (found > 0 && icType ==
"DCOP_RESTART")
1623 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1624 #ifdef Xyce_PARALLEL_MPI
1629 groupPtr_->setAugmentLinearSystem(
true, als);
1630 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1636 groupPtr_->setAugmentLinearSystem(
false, als);
1639 #ifdef Xyce_DEBUG_OP_START
1641 #ifdef Xyce_PARALLEL_MPI
1642 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
1644 groupPtr_->setOutputLinear (&op, &allNodes);
1646 #endif // debug op start
1670 #ifdef Xyce_DEBUG_OP_START
1671 Xyce::dout() <<
"NOX_Interface: Inside continuation=1 OP_START code (case 2)" << std::endl;
1677 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1678 Xyce::NodeNamePairMap & allNodes =
outMgrPtr_->getAllNodes( );
1679 #ifdef Xyce_PARALLEL_MPI
1680 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1683 if (found > 0 && icType ==
"DCOP_RESTART")
1695 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1696 #ifdef Xyce_PARALLEL_MPI
1701 groupPtr_->setAugmentLinearSystem(
true, als);
1702 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1705 groupPtr_->setAugmentLinearSystem(
false, als);
1708 #ifdef Xyce_DEBUG_OP_START
1710 #ifdef Xyce_PARALLEL_MPI
1711 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
1713 groupPtr_->setOutputLinear (&op, &allNodes);
1715 #endif // debug op start
1739 #ifdef Xyce_DEBUG_IC
1740 Xyce::dout() <<
"NOX_Interface: Inside continuation=0 .IC code." << std::endl;
1744 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1746 usedIC = (icType==
"IC" && found > 0);
1749 bool useGminStepping=
false;
1750 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1752 groupPtr_->setAugmentLinearSystem(
true, als);
1774 #ifdef Xyce_DEBUG_IC
1775 Xyce::dout() <<
"NOX_Interface: Inside continuation=3 .IC code." << std::endl;
1778 std::string icType =
"";
1779 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1781 usedIC = (icType==
"IC" && found > 0);
1784 bool useGminStepping=
true;
1785 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1787 groupPtr_->setAugmentLinearSystem(
true, als);
1802 bool usedNODESET(
false);
1804 #ifdef Xyce_DEBUG_IC
1805 Xyce::dout() <<
"NOX_Interface: Inside continuation=0 .NODESET code (case 1)" << std::endl;
1809 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1810 #ifdef Xyce_PARALLEL_MPI
1811 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1814 usedNODESET = (icType==
"NODESET" && found > 0);
1817 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1820 groupPtr_->setAugmentLinearSystem(
true, als);
1821 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1828 groupPtr_->setAugmentLinearSystem(
false, als);
1845 bool usedNODESET(
false);
1847 #ifdef Xyce_DEBUG_IC
1848 Xyce::dout() <<
"NOX_Interface: Inside continuation=1 .NODESET code (case 2)" << std::endl;
1853 Xyce::NodeNamePairMap & op =
outMgrPtr_->getICData(found, icType);
1854 #ifdef Xyce_PARALLEL_MPI
1855 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1858 usedNODESET = (icType==
"NODESET" && found > 0);
1869 Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> als =
1872 groupPtr_->setAugmentLinearSystem(
true, als);
1873 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1876 groupPtr_->setAugmentLinearSystem(
false, als);
1928 Xyce::dout() <<
"takeFirstSolveStep: allocating a new group!" << std::endl;
1937 Xyce::dout() <<
"takeFirstSolveStep: using the old group!" << std::endl;
1944 Xyce::dout() <<
"takeFirstSolveStep: copying over the passed group!" << std::endl;
1959 NOX::StatusTest::StatusType status =
solverPtr_->step();
1962 return (status == NOX::StatusTest::Converged) ? 1 : -1;
1977 NOX::StatusTest::StatusType status =
solverPtr_->step();
1980 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2005 if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 0))
2007 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 1))
2009 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 9))
2011 else if ((!Teuchos::is_null(
stepperPtr_)) && (solverType != 0))
2013 return stepperPtr_->getSolver()->getNumIterations();
2079 return maxNormFindex;
2410 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2414 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2498 const Teuchos::RefCountPtr<LOCA::MultiContinuation::AbstractGroup>& initialGuess,
2499 const Teuchos::RefCountPtr<NOX::StatusTest::Generic>& test,
2500 const Teuchos::RefCountPtr<Teuchos::ParameterList>& p)
2503 Teuchos::rcp(
new LOCA::Stepper(gd, initialGuess, test, p));
2526 if (solverType != 0) retCode =
true;
2547 if (solverType != 0) retCode =
true;