Xyce  6.1
N_NLS_NOX_ParameterSet.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_NLS_NOX_ParameterSet.C,v $
27 //
28 // Purpose : Interface to Xyce vectors for NOX.
29 //
30 // Special Notes :
31 //
32 // Creator : Tammy Kolda, NLS, 8950
33 //
34 // Creation Date : 01/31/02
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.121.2.1 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:20:17 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 // ---------- Standard Includes ----------
49 #include <list>
50 
51 // ---------- Xyce Includes ----------
52 #ifndef HAVE_CONFIG_H
53 #define HAVE_CONFIG_H
54 #endif
55 
56 #include <N_NLS_fwd.h>
57 #include <N_NLS_NOX_Interface.h>
58 #include <N_NLS_NOX_XyceTests.h>
59 #include <N_ERH_ErrorMgr.h>
60 #include <N_ERH_Message.h>
61 #include <N_UTL_Param.h>
62 #include <N_PDS_fwd.h>
63 #include <N_UTL_OptionBlock.h>
64 #include <LOCA.H>
65 #include <N_NLS_ReturnCodes.h>
66 #include <N_LOA_Loader.h>
67 
68 // The following are needed to build AugmentLinSys strategies
75 #include <N_LAS_Builder.h>
76 #include <N_LAS_System.h>
77 #include <N_LAS_QueryUtil.h>
78 #include <Epetra_MapColoring.h>
79 
80 #include <N_UTL_ExtendedString.h>
81 #include <N_UTL_FeatureTest.h>
82 #include <N_UTL_MachDepParams.h>
83 
84 namespace Xyce {
85 namespace Nonlinear {
86 namespace N_NLS_NOX {
87 
88 //-----------------------------------------------------------------------------
89 // Function : ParameterSet::ParameterSet
90 // Purpose : constructor
91 // Special Notes :
92 // Scope : public
93 // Creator :
94 // Creation Date :
95 //-----------------------------------------------------------------------------
97  allParams_(Teuchos::rcp(new Teuchos::ParameterList)),
98  noxParams_(allParams_->sublist("NOX")),
99  locaParams_(allParams_->sublist("LOCA")),
100  debugParams_(allParams_->sublist("DEBUG")),
101  comboPtr_(Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR))),
102  isParamsSet_(false),
103  isStatusTestsSet_(false),
104  continuationSpecified_(false),
105  mode_(mode),
106  noxSolver(0),
107  voltageListType_(VLT_None),
108  gstepping_minimum_conductance_(0.0),
109  savedLocaOptions_(false),
110  debugLevel_(0),
111  debugMinTimeStep_(0),
112  debugMaxTimeStep_(Util::MachineDependentParams::IntMax()),
113  debugMinTime_(0.0),
114  debugMaxTime_(Util::MachineDependentParams::DoubleMax()),
115  screenOutputFlag_(false),
116  maskingFlag_(false),
117  voltageScaleFactor_(1.0)
118 {
119  // Add the main status test to the list of tests to delete in dtor
120  tests_.push_back(comboPtr_);
121 
122  // Default printing options
123 #ifdef Xyce_VERBOSE_NOX
124  noxParams_.sublist("Printing")
125  .set("Output Information",
126  NOX::Utils::Error +
127  NOX::Utils::Warning +
128  NOX::Utils::OuterIteration +
129  NOX::Utils::OuterIterationStatusTest +
130  NOX::Utils::InnerIteration +
131  NOX::Utils::Details +
132  NOX::Utils::StepperIteration +
133  NOX::Utils::StepperDetails +
134  NOX::Utils::Parameters
135  );
136 
137 #else
138  if (VERBOSE_NONLINEAR)
139  noxParams_.sublist("Printing")
140  .set("Output Information",
141  NOX::Utils::Error+
142  NOX::Utils::Warning +
143  NOX::Utils::OuterIteration +
144  NOX::Utils::StepperIteration
145  );
146  else
147  noxParams_.sublist("Printing")
148  .set("Output Information", NOX::Utils::Error);
149 #endif
150  noxParams_.sublist("Printing")
151  .set("Output Stream", Teuchos::RCP<std::ostream>(&dout(), false));
152 
153  // Defaults that are mode dependent
154  switch (mode_)
155  {
157  // These values correspond to N_NLS_DampedNewton.C; see the constructor
158  statusTestParams_.set("ABSTOL", 1.0e-6);
159  statusTestParams_.set("RELTOL", 1.0e-2);
160  statusTestParams_.set("DELTAXTOL", 0.33);
161  statusTestParams_.set("RHSTOL", 1.0e-2);
162  statusTestParams_.set("MAXSTEP", 20);
163  noxParams_.set("Nonlinear Solver", "Line Search Based");
164  noxParams_.sublist("Line Search").set("Method", "Full Step");
165  break;
166  case Nonlinear::HB_MODE:
167  // These values correspond to N_NLS_DampedNewton.C; see the constructor
168  statusTestParams_.set("ABSTOL", 1.0e-9);
169  statusTestParams_.set("RELTOL", 1.0e-3);
170  statusTestParams_.set("DELTAXTOL", 1.0);
171  statusTestParams_.set("RHSTOL", 1.0e-4);
172  statusTestParams_.set("MAXSTEP", 200);
173  noxParams_.set("Nonlinear Solver", "Line Search Based");
174  noxParams_.sublist("Line Search").set("Method", "Full Step");
175  break;
176  default:
177  statusTestParams_.set("ABSTOL", 1.0e-12);
178  statusTestParams_.set("RELTOL", 1.0e-3);
179  statusTestParams_.set("DELTAXTOL", 1.0);
180  statusTestParams_.set("RHSTOL", 1.0e-6);
181  statusTestParams_.set("MAXSTEP", 200);
182  noxParams_.set("Nonlinear Solver", "Line Search Based");
183  noxParams_.sublist("Line Search").set("Method", "Full Step");
184  noxParams_.sublist("Direction").sublist("Newton")
185  .sublist("Linear Solver").set("Tolerance", 1.0e-12);
186  break;
187  }
188 
189  // Parameters that should always be set
190  noxParams_.sublist("Line Search").sublist("Polynomial")
191  .set("Recovery Step Type", "Last Computed Step");
192 
193 
194  // Set default loca options in case this is a loca run.
195  Teuchos::ParameterList& stepperList = locaParams_.sublist("Stepper");
196  Teuchos::ParameterList& predictorList = locaParams_.sublist("Predictor");
197  Teuchos::ParameterList& stepSizeList = locaParams_.sublist("Step Size");
198 
199  stepperList.set("Continuation Method", "Natural");
200  stepperList.set("Skip df/dp", true);
201  predictorList.set("Method", "Tangent");
202 }
203 
204 //-----------------------------------------------------------------------------
205 // Function : ParameterSet::~ParameterSet
206 // Purpose :
207 // Special Notes :
208 // Scope : public
209 // Creator :
210 // Creation Date :
211 //-----------------------------------------------------------------------------
213 {
214 }
215 
216 //-----------------------------------------------------------------------------
217 // Function : ParameterSet::setOptions
218 // Purpose :
219 // Special Notes :
220 // Scope : public
221 // Creator :
222 // Creation Date :
223 //-----------------------------------------------------------------------------
224 bool ParameterSet::setOptions(const Util::OptionBlock& OB)
225 {
226  // Parse the option block
227  bool parseok = parseOptionBlock_(OB);
228  if (!parseok)
229  {
230  return false;
231  }
232 
233  isParamsSet_ = true;
234  return true;
235 }
236 
237 //-----------------------------------------------------------------------------
238 // Function : ParameterSet::setOutputOptions
239 // Purpose : Set output for parallel runs
240 // Special Notes :
241 // Scope : public
242 // Creator :
243 // Creation Date :
244 //-----------------------------------------------------------------------------
245 bool ParameterSet::setOutputOptions(int myPID, int outputProcess)
246 {
247  noxParams_.sublist("Printing").set("MyPID", myPID);
248  noxParams_.sublist("Printing").set("Output Processor",
249  outputProcess);
250  locaParams_.sublist("Utilities").set("MyPID", myPID);
251  locaParams_.sublist("Utilities").set("Output Processor",
252  outputProcess);
253  return true;
254 }
255 
256 //-----------------------------------------------------------------------------
257 // Function : ParameterSet::createStatusTests
258 // Purpose :
259 // Special Notes :
260 // Scope : public
261 // Creator :
262 // Creation Date :
263 //-----------------------------------------------------------------------------
264 bool
266  Parallel::Machine comm,
267  Linear::Vector ** currSolVectorPtrPtr,
269  Linear::Vector * maskVectorPtr) ///< Only when NLS_MASKED_WRMS_NORMS
270 {
271  // Tests All - replaces tests 1-7
272  bool isTransient = false;
274  {
275  isTransient = true;
276  }
277 
278  Teuchos::RCP<XyceTests> allTests;
279 
280  // here we make the default XyceTests object
281  allTests = Teuchos::rcp(new XyceTests(comm,
282  isTransient,
283  statusTestParams_.get("RHSTOL", 1.0e-6),
284  Util::MachineDependentParams::MachineEpsilon(),
285  currSolVectorPtrPtr,
286  statusTestParams_.get("ABSTOL", 1.0e-12),
287  statusTestParams_.get("RELTOL", 1.0e-3),
288  statusTestParams_.get("DELTAXTOL", 1.0),
289  statusTestParams_.get("MAXSTEP", 200),
290  0.9,
291  1.0,
292  0.5*Util::MachineDependentParams::DoubleMax(),
293  1.0e-3,
294  5,
295  statusTestParams_.get("ENFORCEDEVICECONV", 1),
296  statusTestParams_.get("SMALLUPDATETOL", 1.0e-6),
297  &loader,
298  statusTestParams_.get("USEMASKING", false),
299  maskVectorPtr));
300 
301  tests_.push_back(allTests);
302  comboPtr_->addStatusTest(allTests);
303  isStatusTestsSet_ = true;
304  return true;
305 }
306 
307 //-----------------------------------------------------------------------------
308 // Function : ParameterSet::getStatusTests
309 // Purpose :
310 // Special Notes :
311 // Scope : public
312 // Creator :
313 // Creation Date :
314 //-----------------------------------------------------------------------------
315 Teuchos::RCP<NOX::StatusTest::Generic> ParameterSet::getStatusTests()
316 {
317  if (!isStatusTestsSet_)
318  {
319  const std::string message = "Error: N_NLS::NOX::ParameterSet::getStatusTests() - Status tests are not set!";
320  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
321  }
322 
323  return comboPtr_;
324 }
325 
326 //-----------------------------------------------------------------------------
327 // Function : ParameterSet::getAllParams
328 // Purpose :
329 // Special Notes :
330 // Scope : public
331 // Creator :
332 // Creation Date :
333 //-----------------------------------------------------------------------------
334 Teuchos::RCP<Teuchos::ParameterList> ParameterSet::getAllParams()
335 {
336  return allParams_;
337 }
338 
339 //-----------------------------------------------------------------------------
340 // Function : ParameterSet::getNoxParams
341 // Purpose :
342 // Special Notes :
343 // Scope : public
344 // Creator :
345 // Creation Date :
346 //-----------------------------------------------------------------------------
347 Teuchos::RCP<Teuchos::ParameterList> ParameterSet::getNoxParams()
348 {
349  return Teuchos::rcp(&noxParams_, false);
350 }
351 
352 //-----------------------------------------------------------------------------
353 // Function : ParameterSet::getLocaParams
354 // Purpose :
355 // Special Notes :
356 // Scope : public
357 // Creator :
358 // Creation Date :
359 //-----------------------------------------------------------------------------
360 Teuchos::RCP<Teuchos::ParameterList> ParameterSet::getLocaParams()
361 {
362  return Teuchos::rcp(&locaParams_, false);
363 }
364 
365 //-----------------------------------------------------------------------------
366 // Function : ParameterSet::getDebugParams
367 // Purpose :
368 // Special Notes :
369 // Scope : public
370 // Creator :
371 // Creation Date :
372 //-----------------------------------------------------------------------------
373 Teuchos::RCP<Teuchos::ParameterList> ParameterSet::getDebugParams()
374 {
375  return Teuchos::rcp(&debugParams_, false);
376 }
377 
378 //-----------------------------------------------------------------------------
379 // Function : ParameterSet::unsupportedOption_
380 // Purpose :
381 // Special Notes :
382 // Scope : public
383 // Creator :
384 // Creation Date :
385 //-----------------------------------------------------------------------------
386 void ParameterSet::unsupportedOption_(const std::string& tag)
387 {
388  const std::string warning =
389  "Tag \"" + tag + "\" is unsupported by the NOX interface at this time.\n";
390  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING_0, warning);
391 }
392 
393 //-----------------------------------------------------------------------------
394 // Function : ParameterSet::parseOptionBlock_
395 // Purpose :
396 // Special Notes :
397 // Scope : public
398 // Creator :
399 // Creation Date :
400 //-----------------------------------------------------------------------------
401 bool ParameterSet::parseOptionBlock_(const Util::OptionBlock& OB)
402 {
403  // RPP: Some parameters can't be immediately set in the nox
404  // parameter list because they are in a sublist dependent upon
405  // another parameter being set first. We have to store these
406  // parameters until the entire option block is parsed and then set
407  // them in the correct sublist. These parameters are listed below.
408  int maxSearchStep = 2;
409  int in_Forcing = 0;
410  double AZ_tol = 1.0e-12;
411  int recoveryStepType = 0;
412  double recoveryStep = 1.0;
413  int memory = 400;
414 
415 
416  // Loop over all parameters in the option block
417  for (Util::ParamList::const_iterator it_tpL = OB.begin();
418  it_tpL != OB.end(); ++ it_tpL)
419  {
420  const std::string tag = it_tpL->uTag();
421 
422 
423  // Parameters for nonlinear convergence tests
424  if (tag == "ABSTOL")
425  {
426  statusTestParams_.set("ABSTOL", it_tpL->getImmutableValue<double>());
427  }
428  else if (tag == "RELTOL")
429  {
430  statusTestParams_.set("RELTOL", it_tpL->getImmutableValue<double>());
431  }
432  else if (tag == "DELTAXTOL")
433  {
434  statusTestParams_.set("DELTAXTOL", it_tpL->getImmutableValue<double>());
435  }
436  else if (tag == "RHSTOL")
437  {
438  statusTestParams_.set("RHSTOL", it_tpL->getImmutableValue<double>());
439  }
440  else if (tag == "MAXSTEP")
441  {
442  statusTestParams_.set("MAXSTEP", it_tpL->getImmutableValue<int>());
443  }
444  else if (tag == "SMALLUPDATETOL")
445  {
446  statusTestParams_.set("SMALLUPDATETOL", it_tpL->getImmutableValue<double>());
447  }
448 
449  // Check devices for convergence (by calls to cktloader)
450  else if (tag == "ENFORCEDEVICECONV")
451  {
452  statusTestParams_.set("ENFORCEDEVICECONV", it_tpL->getImmutableValue<int>());
453  }
454 
455  // Unsupported options
456  else if (tag == "LINOPT")
457  {
458  unsupportedOption_(tag);
459  }
460  else if (tag == "CONSTRAINTBT")
461  {
462  unsupportedOption_(tag);
463  }
464  else if (tag == "CONSTRAINTMAX")
465  {
466  unsupportedOption_(tag);
467  }
468  else if (tag == "CONSTRAINTMIN")
469  {
470  unsupportedOption_(tag);
471  }
472  else if (tag == "CONSTRAINTCHANGE")
473  {
474  unsupportedOption_(tag);
475  }
476  else if (tag == "NORMLVL")
477  {
478  if (it_tpL->getImmutableValue<int>() != 2)
479  unsupportedOption_(tag);
480  }
481  else if (tag == "DEBUGLEVEL")
482  {
483  debugLevel_ = it_tpL->getImmutableValue<int>();
484  }
485  else if (tag == "SCREENOUTPUT")
486  {
487  screenOutputFlag_ = it_tpL->getImmutableValue<bool>();
488  }
489  else if (tag == "USEMASKING")
490  {
491  maskingFlag_ = it_tpL->getImmutableValue<bool>();
492  }
493  else if (tag == "DEBUGMINTIMESTEP")
494  {
495  debugMinTimeStep_ = it_tpL->getImmutableValue<int>();
496  }
497  else if (tag == "DEBUGMAXTIMESTEP")
498  {
499  debugMaxTimeStep_ = it_tpL->getImmutableValue<int>();
500  }
501  else if (tag == "DEBUGMINTIME")
502  {
503  debugMinTime_ = it_tpL->getImmutableValue<double>();
504  }
505  else if (tag == "DEBUGMAXTIME")
506  {
507  debugMaxTime_ = it_tpL->getImmutableValue<double>();
508  }
509  else if (tag == "DLSDEBUG")
510  unsupportedOption_(tag);
511 
512  // Nonlinear Strategy
513  else if (tag == "NLSTRATEGY")
514  {
515  int val = it_tpL->getImmutableValue<int>();
516  if (val == 0) // Newton
517  {
518  noxParams_.set("Nonlinear Solver", "Line Search Based");
519  noxParams_.sublist("Direction").set("Method", "Newton");
520  }
521  else if (val == 1) // Steepest descent
522  {
523  noxParams_.set("Nonlinear Solver", "Line Search Based");
524  noxParams_.sublist("Direction")
525  .set("Method", "Steepest Descent");
526  }
527  else if (val == 2) // Trust Region
528  {
529  noxParams_.set("Nonlinear Solver", "Trust Region Based");
530  }
531  else if (val == 3) // Modified Newton
532  {
533  noxParams_.set("Nonlinear Solver", "Line Search Based");
534  noxParams_.sublist("Direction")
535  .set("Method", "Modified-Newton");
536  }
537  else if (val == 4) // BFGS
538  {
539  noxParams_.set("Nonlinear Solver", "Line Search Based");
540  noxParams_.sublist("Direction").set("Method", "Quasi-Newton");
541  }
542  else if (val == 5) // Broyden
543  {
544  noxParams_.set("Nonlinear Solver", "Line Search Based");
545  noxParams_.sublist("Direction").set("Method", "Broyden");
546  }
547  else if (val == 6) // Tensor
548  {
549  noxParams_.set("Nonlinear Solver", "Tensor Based");
550  noxParams_.sublist("Direction").set("Method", "Tensor");
551  noxParams_.sublist("Direction").sublist("Tensor")
552  .sublist("Linear Solver").set("Compute Step", "Newton");
553  noxParams_.sublist("Direction").sublist("Tensor")
554  .sublist("Linear Solver").set("Reorthogonalize", "Always");
555  noxParams_.sublist("Line Search").set("Method", "Tensor");
556  noxParams_.sublist("Line Search").sublist("Tensor")
557  .set("Submethod", "Full Step");
558  }
559  else if (val == 7) // Fast Newton Direction
560  {
561  // RPP: No longer supported
562  const std::string warning =
563  "NLStrategy = 7 is no longer supported.\n";
564  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING_0, warning);
565  }
566  else if (val == 8) // Newton/Steepest Descent Combo Direction
567  {
568  // RPP: No longer supported
569  const std::string warning =
570  "NLStrategy = 8 is no longer supported.\n";
571  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING_0, warning);
572  }
573  else
574  {
575  const std::string warning =
576  "NLStrategy is not found!\n";
577  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING_0, warning);
578  }
579  }
580 
581  // Line search method
582  else if (tag == "SEARCHMETHOD")
583  {
584  int val = it_tpL->getImmutableValue<int>();
585  if (val == 0)
586  {
587  noxParams_.sublist("Line Search").set("Method", "Full Step");
588  }
589  else if (val == 1)
590  {
591  noxParams_.sublist("Line Search").set("Method", "Backtrack");
592  }
593  else if (val == 2)
594  {
595  noxParams_.sublist("Line Search").set("Method", "Polynomial");
596  noxParams_.sublist("Line Search").sublist("Polynomial")
597  .set("Interpolation Type", "Quadratic");
598  }
599  else if (val == 3)
600  {
601  noxParams_.sublist("Line Search").set("Method", "Polynomial");
602  noxParams_.sublist("Line Search").sublist("Polynomial")
603  .set("Interpolation Type", "Cubic");
604  }
605  else if (val == 4)
606  {
607  noxParams_.sublist("Line Search")
608  .set("Method", "More'-Thuente");
609  }
610  else
611  {
612  std::ostringstream ost;
613  ost << "ParameterSet::parseOptionBlock_ - "
614  << "SEARCHMETHOD = " << val
615  << " not supported by Xyce at this time." << std::endl;
616  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_WARNING_0, ost.str());
617  }
618  }
619 
620  // Trust Region auxiliary parameters
621  else if (tag == "TRMINRADIUS")
622  {
623  noxParams_.sublist("Trust Region")
624  .set("Minimum Trust Region Radius", it_tpL->getImmutableValue<double>());
625  }
626  else if (tag == "TRMAXRADIUS")
627  {
628  noxParams_.sublist("Trust Region")
629  .set("Maximum Trust Region Radius", it_tpL->getImmutableValue<double>());
630  }
631  else if (tag == "TRMINIMPROVEMENTRATIO")
632  {
633  noxParams_.sublist("Trust Region")
634  .set("Minimum Improvement Ratio", it_tpL->getImmutableValue<double>());
635  }
636  else if (tag == "TRCONTRACTIONRATIO")
637  {
638  noxParams_.sublist("Trust Region")
639  .set("Contraction Trigger Ratio", it_tpL->getImmutableValue<double>());
640  }
641  else if (tag == "TRCONTRACTIONFACTOR")
642  {
643  noxParams_.sublist("Trust Region")
644  .set("Contraction Factor", it_tpL->getImmutableValue<double>());
645  }
646  else if (tag == "TREXPANSIONRATIO")
647  {
648  noxParams_.sublist("Trust Region")
649  .set("Expansion Trigger Ratio", it_tpL->getImmutableValue<double>());
650  }
651  else if (tag == "TREXPANSIONFACTOR")
652  {
653  noxParams_.sublist("Trust Region")
654  .set("Expansion Factor", it_tpL->getImmutableValue<double>());
655  }
656  else if (tag == "TRRECOVERYSTEP")
657  {
658  noxParams_.sublist("Trust Region")
659  .set("Recovery Step", it_tpL->getImmutableValue<double>());
660  }
661 
662  // RPP: Why this is here???
663  else if (tag == "NOX")
664  {
665  // do nothing (this option is handled in the manager)
666  }
667 
668  // LOCA Continuation control
669  // 0 = Nox solve (no continuation)
670  // 1 = Natural Parameter Continuation
671  // 2 = Mosfet Specific Dual Parameter Continuation
672  // 3 = gmin stepping.
673  // 33 = Artificial Parameter Continuation
674  else if (tag == "CONTINUATION")
675  {
677  if (it_tpL->isNumeric())
678  {
679  noxSolver = it_tpL->getImmutableValue<int>();
680  }
681  else
682  {
683  ExtendedString p(it_tpL->stringValue());
684  p.toUpper();
685  if (p.substr(0,4) == "STAN")
686  {
687  noxSolver = 0;
688  }
689  else if (p.substr(0,3) == "NAT")
690  {
691  noxSolver = 1;
692  }
693  else if (p.substr(0,3) == "MOS")
694  {
695  noxSolver = 2;
696  }
697  else if (p.substr(0,4) == "GMIN")
698  {
699  noxSolver = 3;
700  }
701  else if (p.substr(0,6) == "NEWMOS")
702  {
703  noxSolver = 4;
704  }
705  else if (p.substr(0,9) == "BSIM3INV1")
706  {
707  noxSolver = 5;
708  }
709  else if (p.substr(0,9) == "BSIM3INV2")
710  {
711  noxSolver = 6;
712  }
713  else if (p.substr(0,9) == "BLOCKGAIN")
714  {
715  noxSolver = 7;
716  }
717  else if (p.substr(0,4) == "TEST")
718  {
719  noxSolver = 8;
720  }
721  else if (p.substr(0,6) == "PSEUDO")
722  {
723  noxSolver = 9;
724  }
725  else if (p.substr(0,5) == "POWER")
726  {
727  noxSolver = 10;
728  }
729  else if (p.substr(0,3) == "ART")
730  {
731  noxSolver = 33;
732  }
733  else if (p.substr(0,10) == "SOURCESTEP")
734  {
735  noxSolver = 34;
736  }
737  else
738  {
739  std::string message = "Unknown specification in .options for 'continuation': ";
740  message += it_tpL->stringValue();
741  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
742  }
743 
744  // Bail out if option 33 (artif. homotopy) is chosen but
745  // required support is not built in.
746 #ifndef Xyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT
747  if (noxSolver == 33)
748  {
749  Report::UserFatal0() << "Nonlinear Solver (NOX::Interface) Artificial parameter continuation requires "
750  << "building xyce with the define: -DXyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT to "
751  << "allow LOCA to augment the diagonal of Jacobian! Either rebuild Xyce or do not "
752  << "run Xyce with \"continuation=33\"";
753  }
754 #endif
755  }
756  }
757 
758  // Parameters that can't be set in the list until all options
759  // have been parsed
760  else if (tag == "MAXSEARCHSTEP")
761  {
762  maxSearchStep = it_tpL->getImmutableValue<int>();
763  }
764  else if (tag == "IN_FORCING")
765  {
766  in_Forcing = it_tpL->getImmutableValue<int>();
767  }
768  else if (tag == "AZ_TOL")
769  {
770  AZ_tol = it_tpL->getImmutableValue<double>();
771  }
772  else if (tag == "RECOVERYSTEPTYPE")
773  {
774  recoveryStepType = it_tpL->getImmutableValue<int>();
775  }
776  else if (tag == "RECOVERYSTEP")
777  {
778  recoveryStep = it_tpL->getImmutableValue<double>();
779  }
780  else if (tag == "MEMORY")
781  {
782  memory = it_tpL->getImmutableValue<int>();
783  }
784 
785  // Parameters that can't be set in the list until all options
786  // have been parsed
787  else if (tag == "MAXSEARCHSTEP")
788  {
789  maxSearchStep = it_tpL->getImmutableValue<int>();
790  }
791  else if (tag == "IN_FORCING")
792  {
793  in_Forcing = it_tpL->getImmutableValue<int>();
794  }
795  else if (tag == "AZ_TOL")
796  {
797  AZ_tol = it_tpL->getImmutableValue<double>();
798  }
799  else if (tag == "RECOVERYSTEPTYPE")
800  {
801  recoveryStepType = it_tpL->getImmutableValue<int>();
802  }
803  else if (tag == "RECOVERYSTEP")
804  {
805  recoveryStep = it_tpL->getImmutableValue<double>();
806  }
807  else if (tag == "MEMORY")
808  {
809  memory = it_tpL->getImmutableValue<int>();
810  }
811 
812  // Warn user about unrecognized solver option
813  else
814  {
815  Report::UserWarning() << tag << " is not a recognized nonlinear solver option.\n" << std::endl;
816  }
817 
818  } // end loop over all options in block
819 
820 
821  /*
822  Set parameters that are dependent upon other parameters
823 
824  RPP: Some parameters can't be immediately set in the nox
825  parameter list because they are in a sublist dependent upon
826  another parameter being set first. We have to store these
827  parameters until the entire option block is parsed and then set
828  them in the correct sublist.
829  */
830  std::string directionMethod =
831  noxParams_.sublist("Direction").get("Method", "Newton");
832 
833  std::string lineSearchMethod =
834  noxParams_.sublist("Line Search").get("Method", "Full Step");
835 
836  // MAXSEARCHSTEP
837  noxParams_.sublist("Line Search").sublist(lineSearchMethod)
838  .set("Max Iters", maxSearchStep);
839 
840  // In_FORCING
841  if (in_Forcing == 0)
842  {
843  noxParams_.sublist("Direction").sublist(directionMethod)
844  .set("Forcing Term Method", "Constant");
845  }
846  else if (in_Forcing == 1)
847  {
848  noxParams_.sublist("Direction").sublist(directionMethod)
849  .set("Forcing Term Method", "Type 1");
850  noxParams_.sublist("Direction").sublist("Newton")
851  .set("Forcing Term Minimum Tolerance", AZ_tol);
852  }
853  else
854  {
855  noxParams_.sublist("Direction").sublist(directionMethod)
856  .set("Forcing Term Method", "Type 2");
857  noxParams_.sublist("Direction").sublist("Newton")
858  .set("Forcing Term Minimum Tolerance", AZ_tol);
859  }
860 
861  // RECOVERYSTEPTYPE
862  if (recoveryStepType == 1)
863  {
864  // Recovery the NOX way
865  noxParams_.sublist("Line Search").sublist(lineSearchMethod)
866  .set("Recovery Step Type", "Constant");
867  }
868  else
869  {
870  // Recovery the Xyce way
871  noxParams_.sublist("Line Search").sublist(lineSearchMethod)
872  .set("Recovery Step Type", "Last Computed Step");
873  }
874 
875  // RECOVERYSTEP
876  noxParams_.sublist("Line Search").sublist(lineSearchMethod)
877  .set("Recovery Step", recoveryStep);
878 
879  // MEMORY
880  if ((directionMethod == "Quasi-Newton") ||
881  (directionMethod == "Broyden"))
882  noxParams_.sublist("Direction").sublist(directionMethod)
883  .set("Memory", memory);
884 
885 
886  return true;
887 }
888 
889 //-----------------------------------------------------------------------------
890 // Function : ParameterSet::setLocaOptions
891 // Purpose :
892 // Special Notes :
893 // Scope : public
894 // Creator :
895 // Creation Date :
896 //-----------------------------------------------------------------------------
897 bool ParameterSet::setLocaOptions(const Util::OptionBlock& OB, bool saveCopy)
898 {
899  Teuchos::ParameterList& stepperList = locaParams_.sublist("Stepper");
900  Teuchos::ParameterList& predictorList = locaParams_.sublist("Predictor");
901  Teuchos::ParameterList& stepSizeList = locaParams_.sublist("Step Size");
902 
903  bool stepperGiven=false;
904  bool predictorGiven=false;
905 
906  if (saveCopy)
907  {
908  savedLocaOptions_ = true;
909  savedLocaOB_ = OB; // save a copy to re-assert defaults later, if needed.
910  }
911 
912  for (Util::ParamList::const_iterator it_tpL = OB.begin();
913  it_tpL != OB.end(); ++ it_tpL)
914  {
915  const std::string tag = it_tpL->uTag();
916  std::string baseTag=tag.substr(0,8);
917  bool isVectorParam=false;
918  if (baseTag == "CONPARAM" ||
919  baseTag == "MINVALUE" ||
920  baseTag == "MAXVALUE" ||
921  baseTag == "INITIALV" ||
922  baseTag == "INITIALS" ||
923  baseTag == "MINSTEPS" ||
924  (baseTag == "MAXSTEPS" && tag.substr(0,11)=="MAXSTEPSIZE")||
925  baseTag == "AGGRESSI")
926  {
927  if (baseTag == "INITIALV")
928  {
929  baseTag = "INITIALVALUE";
930  }
931  else if (baseTag == "INITIALS")
932  {
933  baseTag = "INITIALSTEPSIZE";
934  }
935  else if (baseTag == "MINSTEPS")
936  {
937  baseTag = "MINSTEPSIZE";
938  }
939  else if (baseTag == "MAXSTEPS")
940  {
941  baseTag = "MAXSTEPSIZE";
942  }
943  else if (baseTag == "AGGRESSI")
944  {
945  baseTag = "AGGRESSIVENESS";
946  }
947 
948  std::string num=tag.substr(baseTag.size(),tag.size()-baseTag.size());
949  int index=ExtendedString(num).Ival();
950  vectorParams[baseTag].push_back(*it_tpL);
951  isVectorParam=true;
952  }
953  if (tag == "STEPPER")
954  {
955  stepperGiven=true;
956  if (it_tpL->isNumeric())
957  {
958  int iType = it_tpL->getImmutableValue<int>();
959  if (iType == 1)
960  {
961  stepperList.set("Continuation Method", "Arc Length");
962  stepperList.set("Skip df/dp", false);
963  }
964  else
965  {
966  stepperList.set("Continuation Method", "Natural");
967  stepperList.set("Skip df/dp", true);
968  }
969  }
970  else
971  {
972  ExtendedString p(it_tpL->stringValue());
973  p.toUpper();
974  if (p.substr(0,3) == "ARC")
975  {
976  stepperList.set("Continuation Method", "Arc Length");
977  stepperList.set("Skip df/dp", false);
978  }
979  else if (p.substr(0,3) == "NAT")
980  {
981  stepperList.set("Continuation Method", "Natural");
982  stepperList.set("Skip df/dp", true);
983  }
984  else
985  {
986  std::string message = "Unknown specification in .options for 'stepper': ";
987  message += it_tpL->stringValue();
988  message += ". Legal choices are ARCLENGTH or NATURAL, which may be abbreviated to three characters.";
989  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
990  }
991  }
992  }
993  else if (tag == "PREDICTOR")
994  {
995  predictorGiven=true;
996  if (it_tpL->isNumeric())
997  {
998  int iType = it_tpL->getImmutableValue<int>();
999  if (iType == 1)
1000  {
1001  predictorList.set("Method", "Tangent");
1002  }
1003  else if (iType == 2)
1004  {
1005  predictorList.set("Method", "Secant");
1006  }
1007  else if (iType == 3)
1008  {
1009  predictorList.set("Method", "Random");
1010  }
1011  else
1012  {
1013  predictorList.set("Method", "Constant");
1014  }
1015  }
1016  else
1017  {
1018  ExtendedString p(it_tpL->stringValue());
1019  p.toUpper();
1020  if (p.substr(0,3) == "TAN")
1021  {
1022  predictorList.set("Method", "Tangent");
1023  }
1024  else if (p.substr(0,3) == "SEC")
1025  {
1026  predictorList.set("Method", "Secant");
1027  }
1028  else if (p.substr(0,3) == "RAN")
1029  {
1030  predictorList.set("Method", "Random");
1031  }
1032  else if (p.substr(0,3) == "CON")
1033  {
1034  predictorList.set("Method", "Constant");
1035  }
1036  else
1037  {
1038  std::string message = "Unknown specification in .options for 'predictor': ";
1039  message += it_tpL->stringValue();
1040  message += ". Legal choices are TANGENT, SECANT, RANDOM, CONSTANT, which may be abbreviated to three characters.";
1041  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1042  }
1043  }
1044  }
1045  // if we're the very first instance of one of these vector params,
1046  // then set our stepperList (this is the old behavior from the
1047  // "alternate" vector handling
1048  else if (tag == "CONPARAM1") // continuation parameter
1049  {
1050  stepperList.set("Continuation Parameter", it_tpL->stringValue());
1051  }
1052  else if (tag == "INITIALVALUE1")
1053  {
1054  stepperList.set("Initial Value", it_tpL->getImmutableValue<double>());
1055  }
1056  else if (tag == "MINVALUE1")
1057  {
1058  gstepping_min_value_ = it_tpL->getImmutableValue<double>();
1059  stepperList.set("Min Value", it_tpL->getImmutableValue<double>());
1060  }
1061  else if (tag == "RESIDUALCONDUCTANCE")
1062  {
1063  gstepping_minimum_conductance_ = it_tpL->getImmutableValue<double>();
1065  {
1066  Report::UserWarning0() << "A non-zero value for the GMIN Stepping residual conductance has been specified (RESIDUALCONDUCTANCE= " << it_tpL->stringValue() << ")." << std::endl
1067  << "This option should never be used unless absolutely necessary to obtain an initial condition for transient runs with ill-posed DC operating points. The operating point obtained by GMIN Stepping will not be a valid steady state condition for the circuit as defined in the netlist, but might possibly produce a reasonable initial condition for transient runs.";
1068  }
1069  }
1070  else if (tag == "INITIALSTEPSIZE1")
1071  {
1072  stepSizeList.set("Initial Step Size", it_tpL->getImmutableValue<double>());
1073  }
1074  else if (tag == "MINSTEPSIZE1")
1075  {
1076  stepSizeList.set("Min Step Size", it_tpL->getImmutableValue<double>());
1077  }
1078  else if (tag == "MAXSTEPSIZE1")
1079  {
1080  stepSizeList.set("Max Step Size", it_tpL->getImmutableValue<double>());
1081  }
1082  else if (tag == "AGGRESSIVENESS1")
1083  {
1084  stepSizeList.set("Aggressiveness", it_tpL->getImmutableValue<double>());
1085  }
1086  else if (tag == "MAXVALUE1")
1087  {
1088  stepperList.set("Max Value", it_tpL->getImmutableValue<double>());
1089  }
1090  else if (tag == "BIFPARAM") // bifurcation parameter
1091  {
1092  stepperList.set("Bifurcation Parameter", it_tpL->stringValue());
1093  }
1094  else if (tag == "MAXSTEPS")
1095  {
1096  stepperList.set("Max Steps", it_tpL->getImmutableValue<int>());
1097  }
1098  else if (tag == "MAXNLITERS")
1099  {
1100  stepperList.set("Max Nonlinear Iterations", it_tpL->getImmutableValue<int>());
1101  }
1102  else if (tag == "STEPCONTROL")
1103  {
1104  if (it_tpL->isNumeric())
1105  {
1106  int iType = it_tpL->getImmutableValue<int>();
1107  if (iType == 1)
1108  stepSizeList.set("Method", "Adaptive");
1109  else
1110  stepSizeList.set("Method", "Constant");
1111  }
1112  else
1113  {
1114  ExtendedString p(it_tpL->stringValue());
1115  p.toUpper();
1116  if (p.substr(0,3) == "ADA")
1117  {
1118  stepSizeList.set("Method", "Adaptive");
1119  }
1120  else if (p.substr(0,3) == "CON")
1121  {
1122  stepSizeList.set("Method", "Constant");
1123  }
1124  else
1125  {
1126  std::string message = "Unknown specification in .options for 'stepcontrol': ";
1127  message += it_tpL->stringValue();
1128  message += ". Legal choices are ADAPTIVE or CONSTANT, which may be abbreviated to three characters.";
1129  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1130  }
1131  }
1132  }
1133  else if (tag == "POWERNODE") // continuation parameter
1134  {
1135  stepperList.set("Power Node", it_tpL->stringValue());
1136  }
1137  else if (tag == "VOLTAGELIST")
1138  {
1139  ExtendedString p(it_tpL->stringValue());
1140  p.toUpper();
1141  if (p.substr(0,3) == "DOF") // DOFS - degrees of freedom
1142  {
1144  }
1145  else if (p.substr(0,3) == "NOD") // NODES - voltage nodes
1146  {
1148  }
1149  else
1150  {
1151  std::string message = "Unknown specification in .options loca for 'voltagelist': ";
1152  message += it_tpL->stringValue();
1153  message += ". Legal choices are DOFS or NODES, which may be abbreviated to three characters.";
1154  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1155  }
1156  }
1157  else if(tag == "VOLTAGESCALEFACTOR")
1158  {
1159  voltageScaleFactor_ = it_tpL->getImmutableValue<double>();
1160  }
1161  // Start of the new parameter section
1162  else if (std::string(tag,0,10) == "PARAMLIST")
1163  {
1164  // don't know what to do yet.
1165  dout() << "tag = " << tag << std::endl;
1166  }
1167  else
1168  {
1169  // if "isVectorParam" we've already handled this at the beginning
1170  // of the loop. Otherwise it's an unrecognized parameter.
1171  if (!isVectorParam)
1172  {
1173  std::string tmp =tag + " is not a recognized loca option.\n";
1174  N_ERH_ErrorMgr::report (N_ERH_ErrorMgr::USR_WARNING_0, tmp);
1175  }
1176  }
1177  }
1178 
1179  // Insure that the correct defaults are set. Sometimes the LOCA
1180  // defaults change in the LOCA library from release to release. However
1181  // Xyce's defaults should not necessarily change in that case.
1182  if (!stepperGiven)
1183  {
1184  stepperList.set("Continuation Method", "Natural");
1185  stepperList.set("Skip df/dp", true);
1186  }
1187 
1188  if (!predictorGiven)
1189  {
1190  predictorList.set("Method", "Tangent");
1191  }
1192 
1193  return true;
1194 }
1195 
1196 //-----------------------------------------------------------------------------
1197 // Function : ParameterSet::getVectorParam
1198 // Purpose : Obtain a parameter specified in the option line in vector syntax
1199 // Special Notes :
1200 // Scope : public
1201 // Creator : Dave Shirley, PSSI
1202 // Creation Date : 02/02/06
1203 //-----------------------------------------------------------------------------
1204 bool ParameterSet::getVectorParam (const std::string & tag, int index, double & value)
1205 {
1206  if (vectorParams.find(tag) != vectorParams.end() &&
1207  vectorParams[tag].size() > index)
1208  {
1209  value = vectorParams[tag][index].getImmutableValue<double>();
1210  return true;
1211  }
1212  else
1213  {
1214  return false;
1215  }
1216 }
1217 
1218 //-----------------------------------------------------------------------------
1219 // Function : ParameterSet::getVectorParam
1220 // Purpose : Obtain a parameter specified in the option line in vector syntax
1221 // Special Notes :
1222 // Scope : public
1223 // Creator : Dave Shirley, PSSI
1224 // Creation Date : 02/02/06
1225 //-----------------------------------------------------------------------------
1226 bool ParameterSet::getVectorParam (const std::string & tag, int index, std::string & value)
1227 {
1228  if (vectorParams.find(tag) != vectorParams.end() &&
1229  vectorParams[tag].size() > index)
1230  {
1231  value = vectorParams[tag][index].stringValue();
1232  return true;
1233  }
1234  else
1235  {
1236  return false;
1237  }
1238 }
1239 
1240 //-----------------------------------------------------------------------------
1241 // Function : ParameterSet::getVectorParamSize
1242 // Purpose :
1243 // Special Notes :
1244 // Scope : public
1245 // Creator :
1246 // Creation Date :
1247 //-----------------------------------------------------------------------------
1248 int ParameterSet::getVectorParamSize(const std::string& tag)
1249 {
1250  if (vectorParams.find(tag) != vectorParams.end())
1251  {
1252  return static_cast<int>(vectorParams[tag].size());
1253  }
1254  else
1255  {
1256  std::string msg = "ParameterSet::getVectorParam - ";
1257  msg += "the parameter \"";
1258  msg += tag;
1259  msg += "\" is required for parameter continuation!";
1260  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
1261  }
1262 
1263  return -1;
1264 }
1265 
1266 //-----------------------------------------------------------------------------
1267 // Function : ParameterSet::getStatusTestReturnCode
1268 // Purpose :
1269 // Special Notes :
1270 // Scope : public
1271 // Creator :
1272 // Creation Date :
1273 //-----------------------------------------------------------------------------
1275 {
1276  // Get the main Xyce Test
1277  Teuchos::RCP<XyceTests> testPtr =
1278  Teuchos::rcp_dynamic_cast<XyceTests>(tests_[1]);
1279  if (Teuchos::is_null(testPtr))
1280  {
1281  const std::string message = "getStatusTestReturnCode - Dynamic cast on Xyce Tests check failed.";
1282  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1283  }
1284 
1285  return testPtr->getXyceReturnCode();
1286 }
1287 
1288 //-----------------------------------------------------------------------------
1289 // Function : ParameterSet::setStatusTestReturnCode
1290 // Purpose :
1291 // Special Notes :
1292 // Scope : public
1293 // Creator :
1294 // Creation Date :
1295 //-----------------------------------------------------------------------------
1297  (const Nonlinear::ReturnCodes & retCodesTmp)
1298 {
1299  // Get the main Xyce Test
1300  Teuchos::RCP<XyceTests> testPtr =
1301  Teuchos::rcp_dynamic_cast<XyceTests>(tests_[1]);
1302  if (Teuchos::is_null(testPtr))
1303  {
1304  const std::string message = "setStatusTestReturnCode - Dynamic cast on Xyce Tests check failed.";
1305  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1306  }
1307 
1308  return testPtr->setReturnCodes (retCodesTmp);
1309 }
1310 
1311 //-----------------------------------------------------------------------------
1312 // Function : ParameterSet::getMaxNormF
1313 // Purpose :
1314 // Special Notes :
1315 // Scope : public
1316 // Creator :
1317 // Creation Date :
1318 //-----------------------------------------------------------------------------
1320 {
1321  // Get the main Xyce Test
1322  Teuchos::RCP<XyceTests> testPtr =
1323  Teuchos::rcp_dynamic_cast<XyceTests>(tests_[1]);
1324  if (Teuchos::is_null(testPtr))
1325  {
1326  const std::string message = "getMaxNormF - Dynamic cast on Xyce Tests check failed.";
1327  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1328  }
1329 
1330  return testPtr->getMaxNormF();
1331 }
1332 
1333 //-----------------------------------------------------------------------------
1334 // Function : ParameterSet::getMaxNormFindex
1335 // Purpose :
1336 // Special Notes :
1337 // Scope : public
1338 // Creator :
1339 // Creation Date :
1340 //-----------------------------------------------------------------------------
1342 {
1343  // Get the main Xyce Test
1344  Teuchos::RCP<XyceTests> testPtr =
1345  Teuchos::rcp_dynamic_cast<XyceTests>(tests_[1]);
1346  if (Teuchos::is_null(testPtr))
1347  {
1348  const std::string message = "getMaxNormFindex - Dynamic cast on Xyce Tests check failed.";
1349  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1350  }
1351 
1352  return testPtr->getMaxNormFindex ();
1353 }
1354 
1355 //-----------------------------------------------------------------------------
1356 // Function : ParameterSet::getNoxSolverType
1357 // Purpose :
1358 // Special Notes :
1359 // Scope : public
1360 // Creator :
1361 // Creation Date :
1362 //-----------------------------------------------------------------------------
1364 {
1365  return noxSolver;
1366 }
1367 
1369 {
1370  noxSolver = type;
1371 }
1372 
1373 //-----------------------------------------------------------------------------
1374 // Function : ParameterSet::createAugmentLinearSystem
1375 // Purpose : creates an AugmentLinSys strategy object.
1376 // Special Notes :
1377 // Scope : public
1378 // Creator : Roger Pawlowski, SNL 1416
1379 // Creation Date : 03/08/06
1380 //-----------------------------------------------------------------------------
1381 Teuchos::RCP<AugmentLinSys>
1382 ParameterSet::createAugmentLinearSystem(Linear::System* ls) const
1383 {
1384  Teuchos::RCP<AugmentLinSys> als;
1385 
1386  if (noxSolver == 9)
1387  {
1388  Teuchos::RCP<Epetra_MapColoring> color_map =
1389  Teuchos::rcp(ls->builder().createSolnColoring());
1390 
1391  if (voltageScaleFactor_ == 1.0)
1392  {
1393  als = Teuchos::rcp( new
1394  AugmentLinSysPseudoTransient(color_map,
1395  ls->getRHSVector()) );
1396  }
1397  else
1398  {
1399  als = Teuchos::rcp( new
1400  AugmentLinSysPseudoTransient(color_map,
1401  ls->getRHSVector(),
1402  true,
1404  }
1405 
1406  }
1407  else if(noxSolver == 1 || noxSolver == 3)
1408  {
1409  if (voltageListType_ == VLT_DOFS)
1410  {
1411  Teuchos::RCP<Epetra_MapColoring> color_map =
1412  Teuchos::rcp(ls->builder().createSolnColoring());
1413 
1414  als = Teuchos::rcp( new GStepping(color_map,
1415  ls->getRHSVector(),
1418  }
1419  else
1420  {
1421  als = Teuchos::rcp( new
1422  GStepping(ls->getQueryUtil()->vnodeGIDVec(),
1423  ls->getRHSVector(),
1426  }
1427  }
1428  else
1429  {
1430  std::string message = "createAugmentLinearSystem - The \'continuation\' ";
1431  message += "parameter in the .options nox list must be set to PSEUDO or NATURAL for ";
1432  message += "this function to be called!";
1433  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1434  }
1435 
1436  return als;
1437 }
1438 
1439 //-----------------------------------------------------------------------------
1440 // Function : ParameterSet::createAugmentLinearSystem
1441 // Purpose : creates an AugmentLinSys strategy object.
1442 // Special Notes :
1443 // Scope : public
1444 // Creator : Dave Shirley, PSSI
1445 // Creation Date : 05/08/06
1446 //-----------------------------------------------------------------------------
1447 Teuchos::RCP<AugmentLinSys>
1448 ParameterSet::createAugmentLinearSystem(Linear::System* ls, IO::InitialConditionsData::NodeNamePairMap & op,
1449  const NodeNameMap & allNodes, N_PDS_Comm * pdsCommPtr
1450  ) const
1451 {
1452  Teuchos::RCP<AugmentLinSys> als;
1453 
1454  als = Teuchos::rcp( new AugmentLinSysOPStart(op, allNodes, pdsCommPtr) );
1455 
1456  return als;
1457 }
1458 
1459 //-----------------------------------------------------------------------------
1460 // Function : ParameterSet::createAugmentLinearSystem
1461 // Purpose : creates an AugmentLinSys strategy object for .IC with
1462 // or without gmin stepping
1463 // Special Notes :
1464 // Scope : public
1465 // Creator : Eric Keiter, SNL
1466 // Creation Date : 03/08/07
1467 //-----------------------------------------------------------------------------
1468 Teuchos::RCP<AugmentLinSys>
1469 ParameterSet::createAugmentLinearSystem(Linear::System* ls, IO::InitialConditionsData::NodeNamePairMap & op,
1470  bool gminStepping) const
1471 {
1472  Teuchos::RCP<AugmentLinSys> als;
1473 
1474  Teuchos::RCP<Epetra_MapColoring> ICcolor_map =
1475  Teuchos::rcp(ls->builder().createInitialConditionColoring());
1476 
1477  if (gminStepping==false)
1478  {
1479  als = Teuchos::rcp( new AugmentLinSysIC(op, ICcolor_map, ls->getRHSVector() ) );
1480  }
1481  else
1482  {
1483  if (voltageListType_ == VLT_DOFS)
1484  {
1485  Teuchos::RCP<Epetra_MapColoring> GMINcolor_map =
1486  Teuchos::rcp(ls->builder().createSolnColoring());
1487 
1488  als = Teuchos::rcp( new AugmentLinSysIC_Gmin(
1489  op,
1490  ICcolor_map,
1491  GMINcolor_map,
1492  ls->getRHSVector(),
1495  }
1496  else
1497  {
1498  als = Teuchos::rcp( new AugmentLinSysIC_Gmin(
1499  op,
1500  ICcolor_map,
1501  //AugmentLinSysIC_Gmin(ls->getQueryUtil()->vnodeGIDVec()),
1502  ls->getQueryUtil()->vnodeGIDVec(),
1503  ls->getRHSVector(),
1506  }
1507  }
1508 
1509  return als;
1510 }
1511 
1512 }}} // namespace N_NLS_NOX
bool setOutputOptions(int myPID, int outputProcess)
std::vector< Teuchos::RCP< NOX::StatusTest::Generic > > tests_
Teuchos::RCP< NOX::StatusTest::Combo > comboPtr_
Teuchos::RCP< Teuchos::ParameterList > getDebugParams()
Pure virtual class to augment a linear system.
Teuchos::RCP< Teuchos::ParameterList > getLocaParams()
bool setOptions(const Xyce::Util::OptionBlock &OB)
Teuchos::RCP< Teuchos::ParameterList > getNoxParams()
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
Definition: N_DEV_Pars.h:1224
bool setLocaOptions(const Xyce::Util::OptionBlock &OB, bool saveCopy=true)
bool getVectorParam(const std::string &, int, double &)
Teuchos::RCP< AugmentLinSys > createAugmentLinearSystem(Xyce::Linear::System *ls) const
std::map< std::string, std::vector< Xyce::Util::Param > > vectorParams
Teuchos::RCP< NOX::StatusTest::Generic > getStatusTests()
void setStatusTestReturnCodes(const Xyce::Nonlinear::ReturnCodes &retCodesTmp)
void unsupportedOption_(const std::string &tag)
bool parseOptionBlock_(const Xyce::Util::OptionBlock &OB)
Teuchos::RCP< Teuchos::ParameterList > getAllParams()
ParameterSet(Xyce::Nonlinear::AnalysisMode mode)
bool createStatusTests(Parallel::Machine comm, N_LAS_Vector **currSolnVectorPtrPtr, Xyce::Loader::NonlinearEquationLoader &nonlinear_equation_loader, N_LAS_Vector *maskVectorPtr=0)
Only used when NLS_MASKED_WRMS_NORMS.
Teuchos::RCP< Teuchos::ParameterList > allParams_
int getVectorParamSize(const std::string &vectorName)
Definition: N_NLS_fwd.h:107
void warning(const std::string &msg)
Definition: N_NLS_NOX.C:66