Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_NLParams.h
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-2014 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_NLParams.h,v $
27 //
28 // Purpose : Basic user-specifid parameters data structure.
29 //
30 // Special Notes :
31 //
32 // Creator : Scott A. Hutchinson, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 04/28/00
35 //
36 // Revision Information:
37 // ----------------------
38 //
39 // Revision Number: $Revision: 1.82 $
40 //
41 // Revision Date : $Date: 2014/02/24 23:49:24 $
42 //
43 // Current Owner : $Author $
44 //-------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_NLS_NLParams_h
47 #define Xyce_N_NLS_NLParams_h
48 
49 // ---------- Standard Includes ----------
50 
51 #include <N_UTL_Misc.h>
52 
53 #ifdef HAVE_CMATH
54 #include <cmath>
55 #else
56 #include <math.h>
57 #endif
58 
59 #include <assert.h>
60 
61 #ifdef HAVE_CLIMITS
62 #include <climits>
63 #else
64 #include <limits.h>
65 #endif
66 
67 #include <N_UTL_Xyce.h>
68 #include <N_IO_fwd.h>
69 #include <N_NLS_Manager.h>
70 #include <N_ERH_ErrorMgr.h>
71 
72 // ---------- Enumerated Types ----------
73 
74 // Support line-search methods.
76  FULL, // Newton's Method, undamped.
77  DIVIDE, // Reduce step-size by successively halving the previous
78  // step.
79  BACKTRACK, // Backtrack using interpolation (ala Dennis & Schnabel).
80  BANK_ROSE, // Bank and Rose algorithm - see method notes.
81  DESCENT, // More'-Thuente line search
82  SIMPLE_BACKTRACK // Simple backtracking method
83 };
84 
85 // Search directions.
86 enum Direction {
87  NEWTON_DIR, // Newton's direction
88  GRADIENT_DIR, // Steepest descent direction
89  MOD_NEWTON_DIR // Modified Newton direction
90 };
91 
92 // Nonlinear solution "strategies".
93 enum NLStrategy {
94  NEWTON, // Pure Newton's method
95  GRADIENT, // Pure gradient method
96  NEWTON_GRADIENT, // Combined Newton/gradient method
97  MOD_NEWTON, // Pure modified Newton's method
98  MOD_NEWTON_GRADIENT // Combined modified-Newton/gradient method
99 };
100 
101 //-----------------------------------------------------------------------------
102 // Class : N_NLS_NLParams
103 // Purpose : Stores nonlinear solver user settings.
104 // Special Notes :
105 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
106 // Creation Date : 5/01/00
107 //-----------------------------------------------------------------------------
109 {
110 public:
111  //N_NLS_NLParams(AnalysisMode mode=DC_OP);
112  N_NLS_NLParams(AnalysisMode mode, N_IO_CmdParse & cp);
113  N_NLS_NLParams(const N_NLS_NLParams & right);
114 
115  ~N_NLS_NLParams();
116 
117  N_NLS_NLParams & operator=(const N_NLS_NLParams & right);
118 
119  // ***** Accessor functions *****
120 
121  void setPrintParamsFlag();
122  void clearPrintParamsFlag();
123  bool getPrintParamsFlag() const;
124 
125  bool setOptions(const N_UTL_OptionBlock & OB);
126  bool setCmdLineOptions ();
127 
128  inline void setNLStrategy(NLStrategy strategy);
129  inline void setNLStrategy(int strategy);
130  inline void resetNLStrategy();
131  inline NLStrategy getNLStrategy() const;
132 
133  inline void setSearchMethod(LineSearchMethod method);
134  inline void setSearchMethod(int method);
135  inline void resetSearchMethod();
136  inline LineSearchMethod getSearchMethod() const;
137 
138  inline void setDirection(Direction value);
139  inline void resetDirection();
140  inline Direction getDirection() const;
141 
142  inline void setDeltaXTol(double Tolerance);
143  inline void resetDeltaXTol();
144  inline double getDeltaXTol() const;
145 
146  inline void setSmallUpdateTol (double Tolerance);
147  inline void resetSmallUpdateTol ();
148  inline double getSmallUpdateTol () const;
149 
150  inline void setEnforceDeviceConvFlag (bool flag);
151  inline void resetEnforceDeviceConvFlag ();
152  inline bool getEnforceDeviceConvFlag () const;
153 
154  inline void setRHSTol(double Tolerance);
155  inline void resetRHSTol();
156  inline double getRHSTol() const;
157 
158  inline void setAbsTol(double Tolerance);
159  inline void resetAbsTol();
160  inline double getAbsTol() const;
161 
162  inline void setRelTol(double Tolerance);
163  inline void resetRelTol();
164  inline double getRelTol() const;
165 
166  inline void setMaxNewtonStep(unsigned maxNewtonStep);
167  inline void resetMaxNewtonStep();
168  inline unsigned getMaxNewtonStep() const;
169 
170  inline void setMaxSearchStep(unsigned maxSearchStep);
171  inline void resetMaxSearchStep();
172  inline unsigned getMaxSearchStep() const;
173 
174  inline void setForcingFlag(bool flag);
175  inline void resetForcingFlag();
176  inline bool getForcingFlag() const;
177 
178  inline void setForcingTerm(double value);
179  inline void resetForcingTerm();
180  inline double getForcingTerm() const;
181 
182  inline void setNormLevel(int level);
183  inline void resetNormLevel();
184  inline int getNormLevel() const;
185 
186  inline void setLinearOpt(bool flag);
187  inline void resetLinearOpt();
188  inline bool getLinearOpt() const;
189 
190  inline void setConstraintBT(bool flag);
191  inline void resetConstraintBT();
192  inline bool getConstraintBT() const;
193 
194  inline void setGlobalBTMax(double value);
195  inline void resetGlobalBTMax();
196  inline double getGlobalBTMax() const;
197 
198  inline void setGlobalBTMin(double value);
199  inline void resetGlobalBTMin();
200  inline double getGlobalBTMin() const;
201 
202  inline void setGlobalBTChange(double value);
203  inline void resetGlobalBTChange();
204  inline double getGlobalBTChange() const;
205 
206  void printParams(std::ostream &os);
207 
208  inline void setDebugLevel(int value);
209  inline void resetDebugLevel();
210  inline int getDebugLevel() const;
211 
212  inline void setDebugMinTimeStep(int value);
213  inline void resetDebugMinTimeStep();
214  inline int getDebugMinTimeStep() const;
215 
216  inline void setDebugMaxTimeStep(int value);
217  inline void resetDebugMaxTimeStep();
218  inline int getDebugMaxTimeStep() const;
219 
220  inline void setDebugMinTime(double value);
221  inline void resetDebugMinTime();
222  inline double getDebugMinTime() const;
223 
224  inline void setDebugMaxTime(double value);
225  inline void resetDebugMaxTime();
226  inline double getDebugMaxTime() const;
227 
228  inline void setScreenOutputFlag (bool bval);
229  inline void resetScreenOutputFlag ();
230  inline bool getScreenOutputFlag () const;
231 
232  inline void setMMFormat(bool value);
233  inline void resetMMFormat();
234  inline bool getMMFormat() const;
235 
236 protected:
237 private:
238 
239 public:
240 
241 protected:
242  // Print control flag
244 
245  // command line parser
246  N_IO_CmdParse * commandLine_;
247 
248  // Calling solution method (e.g., DC Operation Point, Transient, etc.)
251 
252  // Nonlinear solution strategy
254 
255  // Damping method (e.g., Bank and Rose)
257 
258  // Direction flag - dictates which direction to take in advancing the
259  // nonlinear solver.
261 
262  // Absolute convergence tolerance for the norm of the residual.
263  double absTol_;
264 
265  // Relative convergence tolerance.
266  double relTol_;
267 
268  // Weighted deltaX (update) norm tolerance (Petzold)
269  double deltaXTol_;
270 
271  // Special deltaX (update) norm tolerance, used for the
272  // "small update" test.
274 
275  // Weighted RHS (residual) norm tolerance
276  double RHSTol_;
277 
278  // Maximum number of solution steps to attempt.
279  unsigned maxNewtonStep_;
280 
281  // maximum number of damping steps:
282  unsigned maxSearchStep_;
283 
284  // inexact-Newton forcing flag:
286 
287  // check device convergence flag:
289 
290  // inexact-Newton forcing term:
291  double eta_;
292 
293  // norm level:
295 
296  // linear optimization flag
298 
299  // Constraint backtracking flag
301 
302  // Backtracking constraint scalar values. Note that these are used to set
303  // vectors of values to these defaults but, in general, the constraints can
304  // be individually applied to all solution variables (see
305  // N_NLS_ConstraintBT.h).
306  double globalBTMax_;
307  double globalBTMin_;
309 
310  // Debug output options:
318 };
319 
320 //-----------------------------------------------------------------------------
321 // Function : N_NLS_NLParams::setPrintParamsFlag
322 // Purpose : Sets the flag which controls the printing of the nonlinear
323 // solver parameters list. This flag should be set anytime one
324 // of the parameters is modified as the code runs.
325 // Special Notes :
326 // Scope : public
327 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
328 // Creation Date : 01/16/01
329 //-----------------------------------------------------------------------------
331 {
332  printParamsFlag_ = true;
333 }
334 
335 //-----------------------------------------------------------------------------
336 // Function : N_NLS_NLParams::clearPrintParamsFlag
337 // Purpose : Clears the flag which controls the printing of the nonlinear
338 // solver parameters list. This flag is cleared once the
339 // output is printed.
340 // Special Notes :
341 // Scope : public
342 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
343 // Creation Date : 01/16/01
344 //-----------------------------------------------------------------------------
346 {
347  printParamsFlag_ = 0;
348 }
349 
350 //-----------------------------------------------------------------------------
351 // Function : N_NLS_NLParams::getPrintParamsFlag
352 // Purpose : Returns the flag value
353 // Special Notes :
354 // Scope : public
355 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
356 // Creation Date : 01/16/01
357 //-----------------------------------------------------------------------------
359 {
360  return printParamsFlag_;
361 }
362 
363 //-----------------------------------------------------------------------------
364 // Function : N_NLS_NLParams::setNLStrategy
365 // Purpose : Accessor method to set the nonlinear solver strategy.
366 // Special Notes :
367 // Scope : public
368 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
369 // Creation Date : 02/26/01
370 //-----------------------------------------------------------------------------
372 {
373  nlStrategy_ = strategy;
374 
375  // Make sure the method selected is supported, otherwise revert to the
376  // default.
377  if (nlStrategy_ != NEWTON &&
378  nlStrategy_ != GRADIENT &&
380  nlStrategy_ != MOD_NEWTON &&
382  resetNLStrategy();
383 }
384 
385 //-----------------------------------------------------------------------------
386 // Function : N_NLS_NLParams::setNLStrategy
387 // Purpose : Accessor method to set the nonlinear solver strategy.
388 // Special Notes : Takes an integer argument
389 // Scope : public
390 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
391 // Creation Date : 02/26/01
392 //-----------------------------------------------------------------------------
393 inline void N_NLS_NLParams::setNLStrategy(int strategy)
394 {
395  nlStrategy_ = static_cast<NLStrategy> (strategy);
396 
397  // Make sure the method selected is supported, otherwise revert to the
398  // default.
399  if (nlStrategy_ != NEWTON &&
400  nlStrategy_ != GRADIENT &&
402  nlStrategy_ != MOD_NEWTON &&
404  resetNLStrategy();
405 }
406 
407 //-----------------------------------------------------------------------------
408 // Function : N_NLS_NLParams::resetNLStrategy
409 // Purpose : Accessor method to reset the nonlinear solver strategy to
410 // its default.
411 // Special Notes :
412 // Scope : public
413 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
414 // Creation Date : 02/26/01
415 //-----------------------------------------------------------------------------
417 {
419 }
420 
421 //-----------------------------------------------------------------------------
422 // Function : N_NLS_NLParams::getNLStrategy
423 // Purpose : Accessor method to return the nonlinear solver strategy.
424 // Special Notes :
425 // Scope : public
426 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
427 // Creation Date : 02/26/01
428 //-----------------------------------------------------------------------------
430 {
431  return nlStrategy_;
432 }
433 
434 //-----------------------------------------------------------------------------
435 // Function : N_NLS_NLParams::setSearchMethod
436 // Purpose : Accessor method to set the line-search method
437 // Special Notes :
438 // Scope : public
439 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
440 // Creation Date : 01/13/01
441 //-----------------------------------------------------------------------------
443 {
444  searchMethod_ = method;
445 
446  // Revert to the default if the method selected is not supported
447  if (searchMethod_ != FULL &&
448  searchMethod_ != DIVIDE &&
454 }
455 
456 //-----------------------------------------------------------------------------
457 // Function : N_NLS_NLParams::setSearchMethod
458 // Purpose : Accessor method to set the line-search method
459 // Special Notes : Takes and integer argument
460 // Scope : public
461 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
462 // Creation Date : 01/13/01
463 //-----------------------------------------------------------------------------
464 inline void N_NLS_NLParams::setSearchMethod(int method)
465 {
466  searchMethod_ = static_cast<LineSearchMethod> (method);
467 
468  // Revert to the default if the method selected is not supported
469  if (searchMethod_ != FULL &&
470  searchMethod_ != DIVIDE &&
476 }
477 
478 //-----------------------------------------------------------------------------
479 // Function : N_NLS_NLParams::resetSearchMethod
480 // Purpose : Accessor method to reset the default line-search method
481 // Special Notes :
482 // Scope : public
483 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
484 // Creation Date : 01/24/01
485 //-----------------------------------------------------------------------------
487 {
489 }
490 
491 //-----------------------------------------------------------------------------
492 // Function : N_NLS_NLParams::getSearchMethod
493 // Purpose : Accessor method to return the line-search method
494 // Special Notes :
495 // Scope : public
496 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
497 // Creation Date : 01/13/01
498 //-----------------------------------------------------------------------------
500 {
501  return searchMethod_;
502 }
503 
504 //-----------------------------------------------------------------------------
505 // Function : N_NLS_NLParams::setDirection
506 // Purpose : Accessor method to set the nonlinear direction flag.
507 // Special Notes :
508 // Scope : public
509 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
510 // Creation Date : 02/19/01
511 //-----------------------------------------------------------------------------
513 {
514 
515  // Make sure we have a valid value here.
516  assert(value >= 0);
517  direction_ = value;
518 }
519 
520 //-----------------------------------------------------------------------------
521 // Function : N_NLS_NLParams::resetDirection
522 // Purpose : Accessor method to reset the default nonlinear direction
523 // flag.
524 // Special Notes :
525 // Scope : public
526 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
527 // Creation Date : 02/19/01
528 //-----------------------------------------------------------------------------
530 {
532 }
533 
534 //-----------------------------------------------------------------------------
535 // Function : N_NLS_NLParams::getDirection
536 // Purpose : Accessor method to return the nonlinear diection flag.
537 // Special Notes :
538 // Scope : public
539 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
540 // Creation Date : 02/19/01
541 //-----------------------------------------------------------------------------
543 {
544  return direction_;
545 }
546 
547 //-----------------------------------------------------------------------------
548 // Function : N_NLS_NLParams::setDeltaXTol
549 // Purpose : Accessor method to set the deltaX (update) tolerance.
550 // Special Notes : This is used in combination with a WRMS norm.
551 // Scope : public
552 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
553 // Creation Date : 01/20/01
554 //-----------------------------------------------------------------------------
556 {
557  deltaXTol_ = value;
558 }
559 
560 //-----------------------------------------------------------------------------
561 // Function : N_NLS_NLParams::resetDeltaXTol
562 // Purpose : Accessor method to reset the deltaX (update) tolerance to
563 // the default value.
564 // Special Notes : This is used in combination with a WRMS norm.
565 // Scope : public
566 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
567 // Creation Date : 01/20/01
568 //-----------------------------------------------------------------------------
570 {
571  deltaXTol_ = 1.0;
572 }
573 
574 //-----------------------------------------------------------------------------
575 // Function : N_NLS_NLParams::getDeltaXTol
576 // Purpose : Accessor method to return the deltaX (update) tolerance
577 // Special Notes : This is used in combination with a WRMS norm.
578 // Scope : public
579 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
580 // Creation Date : 01/20/01
581 //-----------------------------------------------------------------------------
582 inline double N_NLS_NLParams::getDeltaXTol() const
583 {
584  return deltaXTol_;
585 }
586 
587 //-----------------------------------------------------------------------------
588 // Function : N_NLS_NLParams::setSmallUpdateTol
589 // Purpose :
590 // Special Notes :
591 // Scope : public
592 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
593 // Creation Date : 07/02/03
594 //-----------------------------------------------------------------------------
596 {
598 }
599 
600 //-----------------------------------------------------------------------------
601 // Function : N_NLS_NLParams::resetSmallUpdateTol
602 // Purpose :
603 // Special Notes :
604 // Scope : public
605 // Creator : Eric R. Keiter, SNL, Computational Sciences
606 // Creation Date : 07/02/03
607 //-----------------------------------------------------------------------------
609 {
610  smallUpdateTol_ = 1.0e-6;
611 }
612 
613 //-----------------------------------------------------------------------------
614 // Function : N_NLS_NLParams::getSmallUpdateTol
615 // Purpose :
616 // Special Notes :
617 // Scope : public
618 // Creator : Eric R. Keiter, SNL, Computational Sciences
619 // Creation Date : 07/02/03
620 //-----------------------------------------------------------------------------
621 inline double N_NLS_NLParams::getSmallUpdateTol () const
622 {
623  return smallUpdateTol_;
624 }
625 
626 //-----------------------------------------------------------------------------
627 // Function : N_NLS_NLParams::setRHSTol
628 // Purpose : Accessor method to set the RHS (residual) tolerance.
629 // Special Notes : This is used in combination with a WRMS norm.
630 // Scope : public
631 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
632 // Creation Date : 01/24/01
633 //-----------------------------------------------------------------------------
634 inline void N_NLS_NLParams::setRHSTol(double value)
635 {
636  RHSTol_ = value;
637 }
638 
639 //-----------------------------------------------------------------------------
640 // Function : N_NLS_NLParams::resetRHSTol
641 // Purpose : Accessor method to reset the RHS (residual) tolerance to
642 // the default value.
643 // Special Notes : This is used in combination with a WRMS norm.
644 // Scope : public
645 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
646 // Creation Date : 01/24/01
647 //-----------------------------------------------------------------------------
649 {
650  RHSTol_ = 1.0e-06;
651 }
652 
653 //-----------------------------------------------------------------------------
654 // Function : N_NLS_NLParams::getRHSTol
655 // Purpose : Accessor method to return the RHS (residual) tolerance
656 // Special Notes : This is used in combination with a WRMS norm.
657 // Scope : public
658 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
659 // Creation Date : 01/24/01
660 //-----------------------------------------------------------------------------
661 inline double N_NLS_NLParams::getRHSTol() const
662 {
663  return RHSTol_;
664 }
665 
666 //-----------------------------------------------------------------------------
667 // Function : N_NLS_NLParams::setAbsTol
668 // Purpose : Accessor method to set the absTol tolerance.
669 // Special Notes :
670 // Scope : public
671 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
672 // Creation Date : 01/22/01
673 //-----------------------------------------------------------------------------
674 inline void N_NLS_NLParams::setAbsTol(double value)
675 {
676  absTol_ = value;
677 }
678 
679 //-----------------------------------------------------------------------------
680 // Function : N_NLS_NLParams::resetAbsTol
681 // Purpose : Accessor method to reset the absTol tolerance to
682 // the default value.
683 // Special Notes :
684 // Scope : public
685 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
686 // Creation Date : 01/21/01
687 //-----------------------------------------------------------------------------
689 {
690  absTol_ = 1.0e-12;
691 }
692 
693 //-----------------------------------------------------------------------------
694 // Function : N_NLS_NLParams::getAbsTol
695 // Purpose : Accessor method to return the absTol tolerance
696 // Special Notes :
697 // Scope : public
698 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
699 // Creation Date : 01/21/01
700 //-----------------------------------------------------------------------------
701 inline double N_NLS_NLParams::getAbsTol() const
702 {
703  return absTol_;
704 }
705 
706 //-----------------------------------------------------------------------------
707 // Function : N_NLS_NLParams::setRelTol
708 // Purpose : Accessor method to set the relTol tolerance.
709 // Special Notes :
710 // Scope : public
711 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
712 // Creation Date : 01/22/01
713 //-----------------------------------------------------------------------------
714 inline void N_NLS_NLParams::setRelTol(double value)
715 {
716  relTol_ = value;
717 }
718 
719 //-----------------------------------------------------------------------------
720 // Function : N_NLS_NLParams::resetRelTol
721 // Purpose : Accessor method to reset the relTol tolerance to
722 // the default value.
723 // Special Notes :
724 // Scope : public
725 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
726 // Creation Date : 01/21/01
727 //-----------------------------------------------------------------------------
729 {
730  relTol_ = 1.0e-03;
731 }
732 
733 //-----------------------------------------------------------------------------
734 // Function : N_NLS_NLParams::getRelTol
735 // Purpose : Accessor method to return the relTol tolerance
736 // Special Notes :
737 // Scope : public
738 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
739 // Creation Date : 01/21/01
740 //-----------------------------------------------------------------------------
741 inline double N_NLS_NLParams::getRelTol() const
742 {
743  return relTol_;
744 }
745 
746 //-----------------------------------------------------------------------------
747 // Function : N_NLS_NLParams::setMaxNewtonStep
748 // Purpose : Accessor method to set the maximum number of Newton steps.
749 // Special Notes :
750 // Scope : public
751 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
752 // Creation Date : 01/24/01
753 //-----------------------------------------------------------------------------
755 {
757 }
758 
759 //-----------------------------------------------------------------------------
760 // Function : N_NLS_NLParams::resetMaxNewtonStep
761 // Purpose : Accessor method to reset the maximum number of Newton steps
762 // to the default.
763 // Special Notes :
764 // Scope : public
765 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
766 // Creation Date : 01/24/01
767 //-----------------------------------------------------------------------------
769 {
770  maxNewtonStep_ = 200;
771 }
772 
773 //-----------------------------------------------------------------------------
774 // Function : N_NLS_NLParams::getMaxNewtonStep
775 // Purpose : Accessor method to get the maximum number of Newton steps.
776 // Special Notes :
777 // Scope : public
778 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
779 // Creation Date : 01/24/01
780 //-----------------------------------------------------------------------------
781 inline unsigned N_NLS_NLParams::getMaxNewtonStep() const
782 {
783  return maxNewtonStep_;
784 }
785 
786 //-----------------------------------------------------------------------------
787 // Function : N_NLS_NLParams::setMaxSearchStep
788 // Purpose : Accessor method to set the maximum number of line-search
789 // steps.
790 // Special Notes :
791 // Scope : public
792 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
793 // Creation Date : 01/24/01
794 //-----------------------------------------------------------------------------
796 {
798 }
799 
800 //-----------------------------------------------------------------------------
801 // Function : N_NLS_NLParams::resetMaxSearchStep
802 // Purpose : Accessor method to reset the maximum number of line-search
803 // steps to the default.
804 // Special Notes :
805 // Scope : public
806 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
807 // Creation Date : 01/24/01
808 //-----------------------------------------------------------------------------
810 {
811  maxSearchStep_ = 9;
812 }
813 
814 //-----------------------------------------------------------------------------
815 // Function : N_NLS_NLParams::getMaxSearchStep
816 // Purpose : Accessor method to get the maximum number of line-search
817 // steps.
818 // Special Notes :
819 // Scope : public
820 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
821 // Creation Date : 01/24/01
822 //-----------------------------------------------------------------------------
823 inline unsigned N_NLS_NLParams::getMaxSearchStep() const
824 {
825  return maxSearchStep_;
826 }
827 
828 //-----------------------------------------------------------------------------
829 // Function : N_NLS_NLParams::setForcingFlag
830 // Purpose : Accessor method to set the inexact-Newton forcing flag.
831 // Special Notes :
832 // Scope : public
833 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
834 // Creation Date : 05/04/01
835 //-----------------------------------------------------------------------------
837 {
838 
839  // Reset the linear solver tolerance if we're switching forcing off
840  // NOTE: I couldn't get this to work because we're instantiating several
841  // NLParams objects and the one for which the lasSolverPtr is getting set
842  // isn't the one needed. I've found a work-around for now but we'll need to
843  // fix this - SAH, 6/25/01
844 // if (INForcingFlag_ && !value)
845 // lasSolverPtr_->resetTolerance();
846 
848 }
849 
850 //-----------------------------------------------------------------------------
851 // Function : N_NLS_NLParams::resetForcingFlag
852 // Purpose : Accessor method to reset the default inexact-Newton forcing
853 // flag.
854 // Special Notes :
855 // Scope : public
856 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
857 // Creation Date : 05/04/01
858 //-----------------------------------------------------------------------------
860 {
861  INForcingFlag_ = false;
862 }
863 
864 //-----------------------------------------------------------------------------
865 // Function : N_NLS_NLParams::getForcingFlag
866 // Purpose : Accessor method to get the inexact-Newton forcing flag.
867 // Special Notes :
868 // Scope : public
869 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
870 // Creation Date : 05/04/01
871 //-----------------------------------------------------------------------------
873 {
874  return INForcingFlag_;
875 }
876 
877 //-----------------------------------------------------------------------------
878 // Function : N_NLS_NLParams::setEnforceDeviceConvFlag
879 // Purpose : Accessor method to set the inexact-Newton forcing term.
880 // Special Notes :
881 // Scope : public
882 // Creator : Eric R. Keiter, SNL, Computational Sciences
883 // Creation Date : 06/30/05
884 //-----------------------------------------------------------------------------
886 {
887  enforceDeviceConvFlag_ = flag;
888 }
889 
890 //-----------------------------------------------------------------------------
891 // Function : N_NLS_NLParams::resetEnforceDeviceConvFlag
892 // Purpose : Accessor method to reset the default inexact-Newton forcing
893 // value.
894 // Special Notes :
895 // Scope : public
896 // Creator : Eric R. Keiter, SNL, Computational Sciences
897 // Creation Date : 06/30/05
898 //-----------------------------------------------------------------------------
900 {
901  enforceDeviceConvFlag_ = true;
902 }
903 
904 //-----------------------------------------------------------------------------
905 // Function : N_NLS_NLParams::getEnforceDeviceConvFlag
906 // Purpose : Accessor method to get the inexact-Newton forcing term.
907 // Special Notes :
908 // Scope : public
909 // Creator : Eric R. Keiter, SNL, Computational Sciences
910 // Creation Date : 06/30/05
911 //-----------------------------------------------------------------------------
913 {
914  return enforceDeviceConvFlag_;
915 }
916 
917 //-----------------------------------------------------------------------------
918 // Function : N_NLS_NLParams::setForcingTerm
919 // Purpose : Accessor method to set the inexact-Newton forcing term.
920 // Special Notes :
921 // Scope : public
922 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
923 // Creation Date : 07/29/01
924 //-----------------------------------------------------------------------------
926 {
927  eta_ = value;
928 }
929 
930 //-----------------------------------------------------------------------------
931 // Function : N_NLS_NLParams::resetForcingTerm
932 // Purpose : Accessor method to reset the default inexact-Newton forcing
933 // value.
934 // Special Notes :
935 // Scope : public
936 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
937 // Creation Date : 07/29/01
938 //-----------------------------------------------------------------------------
940 {
941  eta_ = 1.0e-01;
942 }
943 
944 //-----------------------------------------------------------------------------
945 // Function : N_NLS_NLParams::getForcingTerm
946 // Purpose : Accessor method to get the inexact-Newton forcing term.
947 // Special Notes :
948 // Scope : public
949 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
950 // Creation Date : 06/29/01
951 //-----------------------------------------------------------------------------
952 inline double N_NLS_NLParams::getForcingTerm() const
953 {
954  return eta_;
955 }
956 
957 //-----------------------------------------------------------------------------
958 // Function : N_NLS_NLParams::setNormLevel
959 // Purpose : Accessor method to set the lp norm level (p).
960 // Special Notes :
961 // Scope : public
962 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
963 // Creation Date : 01/24/01
964 //-----------------------------------------------------------------------------
966 {
967  normLevel_ = value;
968 }
969 
970 //-----------------------------------------------------------------------------
971 // Function : N_NLS_NLParams::resetNormLevel
972 // Purpose : Accessor method to reset the lp norm level (p) to the
973 // default value.
974 // Special Notes :
975 // Scope : public
976 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
977 // Creation Date : 01/24/01
978 //-----------------------------------------------------------------------------
980 {
981  normLevel_ = 2;
982 }
983 
984 //-----------------------------------------------------------------------------
985 // Function : N_NLS_NLParams::getNormLevel
986 // Purpose : Accessor method to return the lp norm level (p).
987 // Special Notes :
988 // Scope : public
989 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
990 // Creation Date : 01/24/01
991 //-----------------------------------------------------------------------------
993 {
994  return normLevel_;
995 }
996 
997 //-----------------------------------------------------------------------------
998 // Function : N_NLS_NLParams::setLinearOpt
999 // Purpose : Accessor method to set the linear optimization flag.
1000 // Special Notes :
1001 // Scope : public
1002 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1003 // Creation Date : 01/24/01
1004 //-----------------------------------------------------------------------------
1005 inline void N_NLS_NLParams::setLinearOpt(bool flag)
1006 {
1007  linearOptimization_ = flag;
1008 }
1009 
1010 //-----------------------------------------------------------------------------
1011 // Function : N_NLS_NLParams::resetLinearOpt
1012 // Purpose : Accessor method to reset the default linear optimization
1013 // flag.
1014 // Special Notes :
1015 // Scope : public
1016 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1017 // Creation Date : 01/24/01
1018 //-----------------------------------------------------------------------------
1020 {
1021  linearOptimization_ = 0;
1022 }
1023 
1024 //-----------------------------------------------------------------------------
1025 // Function : N_NLS_NLParams::getLinearOpt
1026 // Purpose : Accessor method to return the linear optimization flag.
1027 // Special Notes :
1028 // Scope : public
1029 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1030 // Creation Date : 01/24/01
1031 //-----------------------------------------------------------------------------
1032 inline bool N_NLS_NLParams::getLinearOpt() const
1033 {
1034  return linearOptimization_;
1035 }
1036 
1037 //-----------------------------------------------------------------------------
1038 // Function : N_NLS_NLParams::setConstraintBT
1039 // Purpose : Accessor method to set the constraint backtracking flag.
1040 // Special Notes :
1041 // Scope : public
1042 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1043 // Creation Date : 02/06/01
1044 //-----------------------------------------------------------------------------
1045 inline void N_NLS_NLParams::setConstraintBT(bool flag)
1046 {
1047  constraintBT_ = flag;
1048 }
1049 
1050 //-----------------------------------------------------------------------------
1051 // Function : N_NLS_NLParams::resetConstraintBT
1052 // Purpose : Accessor method to reset the default constraint backtracking
1053 // flag.
1054 // Special Notes :
1055 // Scope : public
1056 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1057 // Creation Date : 02/06/01
1058 //-----------------------------------------------------------------------------
1060 {
1061  constraintBT_ = 0;
1062 }
1063 
1064 //-----------------------------------------------------------------------------
1065 // Function : N_NLS_NLParams::getConstraintBT
1066 // Purpose : Accessor method to return the constraint backtracking flag.
1067 // Special Notes :
1068 // Scope : public
1069 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1070 // Creation Date : 02/06/01
1071 //-----------------------------------------------------------------------------
1073 {
1074  return constraintBT_;
1075 }
1076 
1077 //-----------------------------------------------------------------------------
1078 // Function : N_NLS_NLParams::setGlobalBTMax
1079 // Purpose : Accessor method to set the constraint maximum value.
1080 // Special Notes :
1081 // Scope : public
1082 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1083 // Creation Date : 02/14/01
1084 //-----------------------------------------------------------------------------
1086 {
1087  globalBTMax_ = value;
1088 }
1089 
1090 //-----------------------------------------------------------------------------
1091 // Function : N_NLS_NLParams::resetGlobalBTMax
1092 // Purpose : Accessor method to set the constraint maximum default value.
1093 // Special Notes :
1094 // Scope : public
1095 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1096 // Creation Date : 02/14/01
1097 //-----------------------------------------------------------------------------
1099 {
1100  globalBTMax_ = N_UTL_MachineDependentParams::DoubleMax();
1101 }
1102 
1103 //-----------------------------------------------------------------------------
1104 // Function : N_NLS_NLParams::getGlobalBTMax
1105 // Purpose : Accessor method to return the constraint maximum value.
1106 // Special Notes :
1107 // Scope : public
1108 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1109 // Creation Date : 02/14/01
1110 //-----------------------------------------------------------------------------
1111 inline double N_NLS_NLParams::getGlobalBTMax() const
1112 {
1113  return globalBTMax_;
1114 }
1115 
1116 //-----------------------------------------------------------------------------
1117 // Function : N_NLS_NLParams::setGlobalBTMin
1118 // Purpose : Accessor method to set the constraint minimum value.
1119 // Special Notes :
1120 // Scope : public
1121 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1122 // Creation Date : 02/14/01
1123 //-----------------------------------------------------------------------------
1125 {
1126  globalBTMin_ = value;
1127 }
1128 
1129 //-----------------------------------------------------------------------------
1130 // Function : N_NLS_NLParams::resetGlobalBTMin
1131 // Purpose : Accessor method to set the constraint minimum default value.
1132 // Special Notes :
1133 // Scope : public
1134 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1135 // Creation Date : 02/14/01
1136 //-----------------------------------------------------------------------------
1138 {
1139  globalBTMin_ = -N_UTL_MachineDependentParams::DoubleMax();
1140 }
1141 
1142 //-----------------------------------------------------------------------------
1143 // Function : N_NLS_NLParams::getGlobalBTMin
1144 // Purpose : Accessor method to return the constraint minimum value.
1145 // Special Notes :
1146 // Scope : public
1147 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1148 // Creation Date : 02/14/01
1149 //-----------------------------------------------------------------------------
1150 inline double N_NLS_NLParams::getGlobalBTMin() const
1151 {
1152  return globalBTMin_;
1153 }
1154 
1155 //-----------------------------------------------------------------------------
1156 // Function : N_NLS_NLParams::setGlobalBTChange
1157 // Purpose : Accessor method to set the constraint percentage change
1158 // value.
1159 // Special Notes :
1160 // Scope : public
1161 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1162 // Creation Date : 02/14/01
1163 //-----------------------------------------------------------------------------
1165 {
1167 }
1168 
1169 //-----------------------------------------------------------------------------
1170 // Function : N_NLS_NLParams::resetGlobalBTChange
1171 // Purpose : Accessor method to set the constraint percentage change
1172 // default value.
1173 // Special Notes :
1174 // Scope : public
1175 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1176 // Creation Date : 02/14/01
1177 //-----------------------------------------------------------------------------
1179 {
1180  globalBTChange_ = sqrt(N_UTL_MachineDependentParams::DoubleMax());
1181 }
1182 
1183 //-----------------------------------------------------------------------------
1184 // Function : N_NLS_NLParams::getGlobalBTChange
1185 // Purpose : Accessor method to return the constraint percentage change
1186 // value.
1187 // Special Notes :
1188 // Scope : public
1189 // Creator : Scott A. Hutchinson, SNL, Computational Sciences
1190 // Creation Date : 02/14/01
1191 //-----------------------------------------------------------------------------
1193 {
1194  return globalBTChange_;
1195 }
1196 
1197 //-----------------------------------------------------------------------------
1198 // Function : N_NLS_NLParams::setDebugLevel
1199 // Purpose :
1200 // Special Notes :
1201 // Scope : public
1202 // Creator : Eric R. Keiter, SNL, Computational Sciences
1203 // Creation Date : 09/23/01
1204 //-----------------------------------------------------------------------------
1206 {
1207  debugLevel_ = value;
1208 }
1209 
1210 //-----------------------------------------------------------------------------
1211 // Function : N_NLS_NLParams::resetDebugLevel
1212 // Purpose :
1213 // Special Notes :
1214 // Scope : public
1215 // Creator : Eric R. Keiter, SNL, Computational Sciences
1216 // Creation Date : 09/23/01
1217 //-----------------------------------------------------------------------------
1219 {
1220  debugLevel_ = 1;
1221 }
1222 
1223 //-----------------------------------------------------------------------------
1224 // Function : N_NLS_NLParams::getDebugLevel
1225 // Purpose :
1226 // Special Notes :
1227 // Scope : public
1228 // Creator : Eric R. Keiter, SNL, Computational Sciences
1229 // Creation Date : 09/23/01
1230 //-----------------------------------------------------------------------------
1232 {
1233  return debugLevel_;
1234 }
1235 
1236 
1237 //-----------------------------------------------------------------------------
1238 // Function : N_NLS_NLParams::setDebugMinTimeStep
1239 // Purpose :
1240 // Special Notes :
1241 // Scope : public
1242 // Creator : Eric R. Keiter, SNL, Computational Sciences
1243 // Creation Date : 09/23/01
1244 //-----------------------------------------------------------------------------
1246 {
1248 }
1249 
1250 //-----------------------------------------------------------------------------
1251 // Function : N_NLS_NLParams::resetDebugMinTimeStep
1252 // Purpose :
1253 // Special Notes :
1254 // Scope : public
1255 // Creator : Eric R. Keiter, SNL, Computational Sciences
1256 // Creation Date : 09/23/01
1257 //-----------------------------------------------------------------------------
1259 {
1260  debugMinTimeStep_ = 0;
1261 }
1262 
1263 //-----------------------------------------------------------------------------
1264 // Function : N_NLS_NLParams::getDebugMinTimeStep
1265 // Purpose :
1266 // Special Notes :
1267 // Scope : public
1268 // Creator : Eric R. Keiter, SNL, Computational Sciences
1269 // Creation Date : 09/23/01
1270 //-----------------------------------------------------------------------------
1272 {
1273  return debugMinTimeStep_;
1274 }
1275 
1276 //-----------------------------------------------------------------------------
1277 // Function : N_NLS_NLParams::setDebugMaxTimeStep
1278 // Purpose :
1279 // Special Notes :
1280 // Scope : public
1281 // Creator : Eric R. Keiter, SNL, Computational Sciences
1282 // Creation Date : 09/23/01
1283 //-----------------------------------------------------------------------------
1285 {
1287 }
1288 
1289 //-----------------------------------------------------------------------------
1290 // Function : N_NLS_NLParams::resetDebugMaxTimeStep
1291 // Purpose :
1292 // Special Notes :
1293 // Scope : public
1294 // Creator : Eric R. Keiter, SNL, Computational Sciences
1295 // Creation Date : 09/23/01
1296 //-----------------------------------------------------------------------------
1298 {
1299  debugMaxTimeStep_ = N_UTL_MachineDependentParams::IntMax();
1300 }
1301 
1302 //-----------------------------------------------------------------------------
1303 // Function : N_NLS_NLParams::getDebugMaxTimeStep
1304 // Purpose :
1305 // Special Notes :
1306 // Scope : public
1307 // Creator : Eric R. Keiter, SNL, Computational Sciences
1308 // Creation Date : 09/23/01
1309 //-----------------------------------------------------------------------------
1311 {
1312  return debugMaxTimeStep_;
1313 }
1314 
1315 //-----------------------------------------------------------------------------
1316 // Function : N_NLS_NLParams::setDebugMinTime
1317 // Purpose :
1318 // Special Notes :
1319 // Scope : public
1320 // Creator : Eric R. Keiter, SNL, Computational Sciences
1321 // Creation Date : 09/23/01
1322 //-----------------------------------------------------------------------------
1324 {
1325  debugMinTime_ = value;
1326 }
1327 
1328 //-----------------------------------------------------------------------------
1329 // Function : N_NLS_NLParams::resetDebugMinTime
1330 // Purpose :
1331 // Special Notes :
1332 // Scope : public
1333 // Creator : Eric R. Keiter, SNL, Computational Sciences
1334 // Creation Date : 09/23/01
1335 //-----------------------------------------------------------------------------
1337 {
1338  debugMinTime_ = 0.0;
1339 }
1340 
1341 //-----------------------------------------------------------------------------
1342 // Function : N_NLS_NLParams::getDebugMinTime
1343 // Purpose :
1344 // Special Notes :
1345 // Scope : public
1346 // Creator : Eric R. Keiter, SNL, Computational Sciences
1347 // Creation Date : 09/23/01
1348 //-----------------------------------------------------------------------------
1349 inline double N_NLS_NLParams::getDebugMinTime() const
1350 {
1351  return debugMinTime_;
1352 }
1353 
1354 //-----------------------------------------------------------------------------
1355 // Function : N_NLS_NLParams::setDebugMaxTime
1356 // Purpose :
1357 // Special Notes :
1358 // Scope : public
1359 // Creator : Eric R. Keiter, SNL, Computational Sciences
1360 // Creation Date : 09/23/01
1361 //-----------------------------------------------------------------------------
1363 {
1364  debugMaxTime_ = value;
1365 }
1366 
1367 //-----------------------------------------------------------------------------
1368 // Function : N_NLS_NLParams::resetDebugMaxTime
1369 // Purpose :
1370 // Special Notes :
1371 // Scope : public
1372 // Creator : Eric R. Keiter, SNL, Computational Sciences
1373 // Creation Date : 09/23/01
1374 //-----------------------------------------------------------------------------
1376 {
1377  debugMaxTime_ = N_UTL_MachineDependentParams::DoubleMax();
1378 }
1379 
1380 //-----------------------------------------------------------------------------
1381 // Function : N_NLS_NLParams::getDebugMaxTime
1382 // Purpose :
1383 // Special Notes :
1384 // Scope : public
1385 // Creator : Eric R. Keiter, SNL, Computational Sciences
1386 // Creation Date : 09/23/01
1387 //-----------------------------------------------------------------------------
1388 inline double N_NLS_NLParams::getDebugMaxTime() const
1389 {
1390  return debugMaxTime_;
1391 }
1392 
1393 //-----------------------------------------------------------------------------
1394 // Function : N_NLS_NLParams::setScreenOutputFlag
1395 // Purpose :
1396 // Special Notes :
1397 // Scope : public
1398 // Creator : Eric R. Keiter, SNL, Computational Sciences
1399 // Creation Date : 04/25/04
1400 //-----------------------------------------------------------------------------
1402 {
1403  screenOutputFlag_ = bval;
1404 }
1405 
1406 //-----------------------------------------------------------------------------
1407 // Function : N_NLS_NLParams::resetScreenOutputFlag
1408 // Purpose :
1409 // Special Notes :
1410 // Scope : public
1411 // Creator : Eric R. Keiter, SNL, Computational Sciences
1412 // Creation Date : 04/25/04
1413 //-----------------------------------------------------------------------------
1415 {
1416  screenOutputFlag_ = false;
1417 }
1418 
1419 //-----------------------------------------------------------------------------
1420 // Function : N_NLS_NLParams::getScreenOutputFlag
1421 // Purpose :
1422 // Special Notes :
1423 // Scope : public
1424 // Creator : Eric R. Keiter, SNL, Computational Sciences
1425 // Creation Date : 04/25/04
1426 //-----------------------------------------------------------------------------
1428 {
1429  return screenOutputFlag_;
1430 }
1431 
1432 //-----------------------------------------------------------------------------
1433 // Function : N_NLS_NLParams::setMMFormat
1434 // Purpose :
1435 // Special Notes :
1436 // Scope : public
1437 // Creator : Eric R. Keiter, SNL, Computational Sciences
1438 // Creation Date :
1439 //-----------------------------------------------------------------------------
1441 {
1443 }
1444 
1445 //-----------------------------------------------------------------------------
1446 // Function : N_NLS_NLParams::resetMMFormat
1447 // Purpose :
1448 // Special Notes :
1449 // Scope : public
1450 // Creator : Eric R. Keiter, SNL, Computational Sciences
1451 // Creation Date :
1452 //-----------------------------------------------------------------------------
1454 {
1455  matrixMarketFormat_=false;
1456 }
1457 
1458 //-----------------------------------------------------------------------------
1459 // Function : N_NLS_NLParams::getMMFormat
1460 // Purpose :
1461 // Special Notes :
1462 // Scope : public
1463 // Creator : Eric R. Keiter, SNL, Computational Sciences
1464 // Creation Date :
1465 //-----------------------------------------------------------------------------
1466 inline bool N_NLS_NLParams::getMMFormat() const
1467 {
1468  return matrixMarketFormat_;
1469 }
1470 
1471 #endif // Xyce_N_NLS_NLParams_h