Xyce  6.1
N_ANP_ROL.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_ANP_ROL.h,v $
27 //
28 // Purpose : ROL analysis class
29 //
30 // Special Notes : Specify any "hidden" or subtle details of the class here.
31 // Portability details, error handling information, etc.
32 //
33 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
34 //
35 // Creation Date : 01/24/08
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.11 $
41 //
42 // Revision Date : $Date: 2015/10/27 19:24:39 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #ifndef Xyce_N_ANP_ROL_h
48 #define Xyce_N_ANP_ROL_h
49 
50 #include <N_ANP_fwd.h>
51 
52 #include <N_ANP_AnalysisBase.h>
53 #include <N_ANP_AnalysisManager.h>
54 #include <N_ANP_RegisterAnalysis.h>
55 #include <N_ANP_SweepParam.h>
56 
57 namespace Xyce {
58 namespace Analysis {
59 
60 typedef double RealT;
61 //-------------------------------------------------------------------------
62 // Class : ROL
63 // Purpose : ROL analysis class
64 // Special Notes :
65 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
66 // Creation Date : 01/24/08
67 //-------------------------------------------------------------------------
68 // Revised: Timur Takhtaganov, 06/03/2015
69 //
70 class ROL : public AnalysisBase
71 {
72  template <class RealT>
74  template <class RealT>
76 
77 public:
78  ROL(
79  AnalysisManager &analysis_manager,
80  Nonlinear::Manager &nonlinear_manager,
81  Loader::Loader &loader,
82  Linear::System & linear_system,
83  Topo::Topology & topology,
84  IO::InitialConditionsManager & initial_conditions_manager);
85 
86  virtual ~ROL();
87 
88  bool setAnalysisParams(const Util::OptionBlock & paramsBlock);
89  bool setTimeIntegratorOptions(const Util::OptionBlock &option_block);
90 
91  void setTIAParams(const TimeIntg::TIAParams &tia_params)
92  {
93  tiaParams_ = tia_params;
94  }
95  const TimeIntg::TIAParams &getTIAParams() const; // override
96  TimeIntg::TIAParams &getTIAParams(); // override
97 
98  bool getDCOPFlag() const // override
99  {
100  return true;
101  }
102 
103 
104 
105 protected:
106  bool doRun();
107  bool doInit();
108  bool doLoopProcess();
109  bool runROLAnalysis();
111  bool doProcessFailedStep();
112  bool doHandlePredictor();
113  bool doFinish();
114 
115  // virtual bool doProcessSuccessfulDCOPStep() { // override
116  // return true;
117  // }
118 
119  // virtual bool doProcessFailedDCOPStep() { // override
120  // return true;
121  // }
122 
123  bool doAllocations(int nc, int nz);
124  bool doFree();
125  std::vector<Linear::Vector *> solutionPtrVector_;
126  std::vector<Linear::Vector *> statePtrVector_;
127  std::vector<Linear::Vector *> constraintPtrVector_;
128  std::vector<Linear::Vector *> jvecPtrVector_;
129  std::vector<Linear::Vector *> testPtrVector_;
130  std::vector<Linear::Vector *> mydfdpPtrVector_;
131  std::vector<Linear::Vector *> mydqdpPtrVector_;
132  std::vector<Linear::Vector *> mydbdpPtrVector_;
133  std::vector<Linear::Vector *> mysensRHSPtrVector_;
134 
135 public:
136  // Two Level specific
137  bool twoLevelStep();
138  void setSweepValue(int step);
139 
140 private:
141  void initializeSolution_();
142  void takeStep_();
143 
144  std::vector<int> rolSweepFailures_; // TT
145 
146 private:
150  Topo::Topology & topology_;
151  IO::InitialConditionsManager & initialConditionsManager_;
152  Linear::System & linearSystem_;
158  std::vector<std::string> paramNameVec_; // TT: vector of optimization parameters
159  int numParams_; // TT: number of optimization parameters
160  std::vector<std::string> uncertainParams_; // TT: vector of parameters with uncertainty
161 
162 };
163 
164 
165 bool registerROLFactory(FactoryBlock &factory_block);
166 
167 } // namespace Analysis
168 } // namespace Xyce
169 
170 #endif // Xyce_N_ANP_ROL_h
bool doProcessSuccessfulStep()
Definition: N_ANP_ROL.C:597
void setSweepValue(int step)
Definition: N_ANP_ROL.C:376
SweepVector stepSweepVector_
Definition: N_ANP_ROL.h:155
Loader::Loader & loader_
Definition: N_ANP_ROL.h:149
std::vector< Linear::Vector * > mysensRHSPtrVector_
Definition: N_ANP_ROL.h:133
double RealT
Definition: N_ANP_ROL.h:60
std::vector< int > rolSweepFailures_
Definition: N_ANP_ROL.h:144
bool doProcessFailedStep()
Definition: N_ANP_ROL.C:685
std::vector< std::string > paramNameVec_
Definition: N_ANP_ROL.h:158
Pure virtual class to augment a linear system.
bool doAllocations(int nc, int nz)
Definition: N_ANP_ROL.C:521
IO::InitialConditionsManager & initialConditionsManager_
Definition: N_ANP_ROL.h:151
bool doHandlePredictor()
Definition: N_ANP_ROL.C:466
AnalysisManager & analysisManager_
Definition: N_ANP_ROL.h:147
void setTIAParams(const TimeIntg::TIAParams &tia_params)
Definition: N_ANP_ROL.h:91
std::vector< Linear::Vector * > statePtrVector_
Definition: N_ANP_ROL.h:126
Nonlinear::Manager & nonlinearManager_
Definition: N_ANP_ROL.h:148
bool registerROLFactory(FactoryBlock &factory_block)
Definition: N_ANP_ROL.C:2151
The FactoryBlock contains parameters needed by the analysis creation functions.
TimeIntg::TIAParams tiaParams_
Definition: N_ANP_ROL.h:154
std::vector< Linear::Vector * > mydqdpPtrVector_
Definition: N_ANP_ROL.h:131
void initializeSolution_()
Definition: N_ANP_ROL.C:349
ROL(AnalysisManager &analysis_manager, Nonlinear::Manager &nonlinear_manager, Loader::Loader &loader, Linear::System &linear_system, Topo::Topology &topology, IO::InitialConditionsManager &initial_conditions_manager)
Definition: N_ANP_ROL.C:144
std::vector< Linear::Vector * > constraintPtrVector_
Definition: N_ANP_ROL.h:127
std::vector< Linear::Vector * > solutionPtrVector_
Definition: N_ANP_ROL.h:125
std::vector< Linear::Vector * > testPtrVector_
Definition: N_ANP_ROL.h:129
std::vector< std::string > uncertainParams_
Definition: N_ANP_ROL.h:160
std::vector< Linear::Vector * > mydbdpPtrVector_
Definition: N_ANP_ROL.h:132
friend class EqualityConstraint_ROL_DC_UQ
Definition: N_ANP_ROL.h:75
std::vector< Linear::Vector * > mydfdpPtrVector_
Definition: N_ANP_ROL.h:130
std::vector< Linear::Vector * > jvecPtrVector_
Definition: N_ANP_ROL.h:128
std::vector< SweepParam > SweepVector
Definition: N_ANP_fwd.h:94
bool setTimeIntegratorOptions(const Util::OptionBlock &option_block)
Definition: N_ANP_ROL.C:203
OutputMgrAdapter & outputManagerAdapter_
Definition: N_ANP_ROL.h:153
Linear::System & linearSystem_
Definition: N_ANP_ROL.h:152
bool getDCOPFlag() const
Definition: N_ANP_ROL.h:98
Topo::Topology & topology_
Definition: N_ANP_ROL.h:150
const TimeIntg::TIAParams & getTIAParams() const
Definition: N_ANP_ROL.C:247
friend class EqualityConstraint_ROL_DC
Definition: N_ANP_ROL.h:73
bool setAnalysisParams(const Util::OptionBlock &paramsBlock)
Definition: N_ANP_ROL.C:238