Xyce  6.1
N_NLS_NOX_ParameterSet.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-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.h,v $
27 //
28 // Purpose : Specification file which declares an interface common to
29 // all supported nonlinear solver algorithms. The Manager
30 // class uses this interface to call a concrete algorithm.
31 //
32 // Special Notes : This is the "Strategy" class in the Strategy design
33 // pattern.
34 //
35 // Creator : Scott A. Hutchinson, SNL, Parallel Computational Sciences
36 //
37 // Creation Date : 04/28/00
38 //
39 // Revision Information:
40 // ---------------------
41 //
42 // Revision Number: $Revision: 1.64 $
43 //
44 // Revision Date : $Date: 2015/05/13 14:22:07 $
45 //
46 // Current Owner : $Author: dgbaur $
47 //-------------------------------------------------------------------------
48 
49 #ifndef Xyce_N_NLS_NOX_ParameterSet_h
50 #define Xyce_N_NLS_NOX_ParameterSet_h
51 
52 #include <vector>
53 
54 #include <N_LAS_fwd.h>
55 #include <N_LOA_fwd.h>
56 #include <N_NLS_fwd.h>
57 #include <N_PDS_fwd.h>
58 #include <N_UTL_NoCase.h>
59 
60 #include <N_IO_InitialConditions.h>
61 
62 #include "NOX.H"
63 #include "Teuchos_RCP.hpp"
64 
65 namespace Xyce {
66 namespace Nonlinear {
67 namespace N_NLS_NOX {
68 
69 //-----------------------------------------------------------------------------
70 // Class : N_NLS_NonLinearSolver
71 // Purpose : Nonlinear Solver Abstract Class
72 // Creator : Tammy Kolda, SNL, 8950
73 // Creation Date : 2/5/02
74 //-----------------------------------------------------------------------------
75 class ParameterSet {
76 
77 public:
78 
80  ~ParameterSet();
81  bool setOptions(const Xyce::Util::OptionBlock& OB);
82  bool setLocaOptions(const Xyce::Util::OptionBlock& OB, bool saveCopy=true);
84  {
85  bool ret=true;
87  {
88  ret=setLocaOptions(savedLocaOB_, false);
89  }
90  return ret;
91  }
92 
93  bool setOutputOptions(int myPID, int outputProcess);
94  bool createStatusTests(
95  Parallel::Machine comm,
96  Xyce::Linear::Vector ** currSolnVectorPtrPtr,
97  Xyce::Loader::NonlinearEquationLoader& nonlinear_equation_loader,
98  Xyce::Linear::Vector * maskVectorPtr = 0); ///< Only used when NLS_MASKED_WRMS_NORMS
99 
100  Teuchos::RCP<NOX::StatusTest::Generic> getStatusTests();
101  bool getVectorParam (const std::string &, int, double &);
102  bool getVectorParam (const std::string &, int, std::string &);
103  int getVectorParamSize(const std::string& vectorName);
104  int getStatusTestReturnCode() const;
105  void setStatusTestReturnCodes (const Xyce::Nonlinear::ReturnCodes & retCodesTmp);
106 
107  Teuchos::RCP<Teuchos::ParameterList> getAllParams();
108  Teuchos::RCP<Teuchos::ParameterList> getNoxParams();
109  Teuchos::RCP<Teuchos::ParameterList> getLocaParams();
110  Teuchos::RCP<Teuchos::ParameterList> getDebugParams();
111  int getNoxSolverType() const;
112  void setNoxSolverType(int type);
113 
115  {
116  return continuationSpecified_;
117  }
118 
119  inline int getDebugLevel() const
120  {
121  return debugLevel_;
122  };
123 
124  inline int getDebugMinTimeStep() const
125  {
126  return debugMinTimeStep_;
127  };
128 
129  inline int getDebugMaxTimeStep() const
130  {
131  return debugMaxTimeStep_;
132  };
133 
134  inline double getDebugMinTime() const
135  {
136  return debugMinTime_;
137  };
138 
139  inline double getDebugMaxTime() const
140  {
141  return debugMaxTime_;
142  };
143 
144  inline bool getScreenOutputFlag () const
145  {
146  return screenOutputFlag_;
147  };
148 
149  double getMaxNormF() const;
150  int getMaxNormFindex () const;
151 
152  inline bool isParamsSet() const
153  {
154  return isParamsSet_;
155  };
156 
157  inline void set_gstepping_min_value (double val)
158  {
160  }
161 
162  inline void set_gstepping_minimum_conductance (double val)
163  {
165  }
166 
167  Teuchos::RCP<AugmentLinSys>
168  createAugmentLinearSystem(Xyce::Linear::System* ls) const;
169 
170  // Create augmented linear system, DCOP restart version
171  Teuchos::RCP<AugmentLinSys>
172  createAugmentLinearSystem(Xyce::Linear::System* ls,
173  Xyce::IO::InitialConditionsData::NodeNamePairMap & op,
174  const Xyce::NodeNameMap & allNodes, N_PDS_Comm * pdsCommPtr) const;
175 
176  // Create augmented linear system, IC version
177  Teuchos::RCP<AugmentLinSys>
178  createAugmentLinearSystem(Xyce::Linear::System* ls,
179  Xyce::IO::InitialConditionsData::NodeNamePairMap & op,
180  bool gminStepping=false) const;
181 
182 private:
183 
184  void unsupportedOption_(const std::string& tag);
185  bool parseOptionBlock_(const Xyce::Util::OptionBlock& OB);
186 
187 private:
188 
189  Teuchos::RCP<Teuchos::ParameterList> allParams_;
190  Teuchos::ParameterList& noxParams_;
191  Teuchos::ParameterList& locaParams_;
192  Teuchos::ParameterList& debugParams_;
193  Teuchos::ParameterList statusTestParams_;
194 
195  std::map<std::string, std::vector<Xyce::Util::Param> > vectorParams;
196 
197  // Combo of all tests
198  Teuchos::RCP<NOX::StatusTest::Combo> comboPtr_;
199 
200  // Vector containing all the tests we create
201  std::vector< Teuchos::RCP<NOX::StatusTest::Generic> > tests_;
202 
205 
207 
209 
211 
212  // This object acts as a factory for the augment system strategy.
217  };
218 
220 
222 
223  // Minimum parameter value used in gstepping
225 
226  // Evil, evil gmin stepping hack, a residual conductance that should almost
227  // always be zero.
229 
231  Xyce::Util::OptionBlock savedLocaOB_;
232 
233  // debug info:
241 };
242 
243 }}} // namespace N_NLS_NOX
244 
245 #endif
246 
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)
bool createStatusTests(Parallel::Machine comm, Xyce::Linear::Vector **currSolnVectorPtrPtr, Xyce::Loader::NonlinearEquationLoader &nonlinear_equation_loader, Xyce::Linear::Vector *maskVectorPtr=0)
Only used when NLS_MASKED_WRMS_NORMS.
Teuchos::RCP< Teuchos::ParameterList > getNoxParams()
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)
Teuchos::RCP< Teuchos::ParameterList > allParams_
int getVectorParamSize(const std::string &vectorName)